Hey!! I have some exception in my c# project can anyone please help me ?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.IO;
using System.Threading;
namespace newClient
{
class Connection
{
//Thread _threadObj;
TcpClient _TcpObj;
NetworkStream _NSObj;
StreamReader _SRObj;
StreamWriter _SWObj;
string _MainIp;
int _Socket;
string _UserName;
public string _USERNAME
{
get
{
return _UserName;
}
set
{
_UserName = value;
}
}
public int _SOCKET
{
get
{
return _Socket;
}
set
{
_Socket = value;
}
}
public string _MAINIP
{
get
{
return _MainIp;
}
set
{
_MainIp = value;
}
}
public string LocalIPAddress()
{
IPHostEntry host;
string localIP = "";
host = Dns.GetHostEntry(Dns.GetHostName());
foreach (IPAddress ip in host.AddressList)
{
if (ip.AddressFamily == AddressFamily.InterNetwork)
{
localIP = ip.ToString();
}
}
return localIP;
}
public void ConnectionEstablish()
{
_TcpObj = new TcpClient("192.168.1.12", 6060);
_NSObj = _TcpObj.GetStream();
_SRObj = new StreamReader(_NSObj);
_SWObj = new StreamWriter(_NSObj);
}
public void ConnectionRemove()
{
_TcpObj.Close();
_NSObj.Dispose();
_SRObj.Dispose();
_SWObj.Dispose();
}
my connection is not establish
public void ConnectionEstablish()
{
_TcpObj = new TcpClient("192.168.1.12", 6060);
_NSObj = _TcpObj.GetStream();
_SRObj = new StreamReader(_NSObj);
_SWObj = new StreamWriter(_NSObj);
}
here i got exception
still... try pinging the adress yourself.
try making a rule for your firewall on outgoing connections (or turn it off while running the programm)
try making a rule for your router on outgoing connections