hi every one and thanks in advance please forgive my poor level in english but i want some help : my probleme is that i'm trying to make an application that send bytes over the Intenet and whene ever i try to connect it says : connections could not be done machine actvely refused IP:PORT
keep in minde :
- the application works whene i try to connect with "127.0.0.1"
- fire wall is off
- port open.Whene i run "NetStat -an" command in CMD it shows my app like this 0000:Port LISTENING wich mean the server is listning
- both the server and the client uses the same port
and this is the code for the Server
public static void start()
{
SocketPermission permission = new SocketPermission(NetworkAccess.Accept, TransportType.Tcp,"", SocketPermission.AllPorts);
sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, Settings.Protcole);
permission.Demand();
IPEndPoint end = new IPEndPoint(IPAddress.Any, Settings.Port);
sock.Bind(end);
sock.Listen(10);
accepted = sock.Accept();
Connected = true;
}
and this is the code for the client
public static void Connect(string IP)
{
try
{
SocketPermission permission = new SocketPermission(NetworkAccess.Accept, TransportType.Tcp, Server.GetIP(), SocketPermission.AllPorts);
sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, Settings.Protcole);
permission.Demand();
IPEndPoint end = new IPEndPoint(IPAddress.Parse(IP), Settings.Port);
sock.Connect(end);
Connected = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "O.o", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}