Reputation: 844
The problem that im facing is given in the Headline. This is where i am :
Got a Socket Server up and running on Port 61911 :
_server.Bind(new IPEndPoint(IPAddress.Any, 61911));
And that port (61911) is opened globally and set the Server IP Address to 192.168.1.2 (My PC)
Firewall and Antivirus Programs are dealed well.
Ran the Socket Server and got port open status from YouGetSignal.com
Pic :
http://img189.imageshack.us/img189/1777/x07w.png
And while ^Checking, the Socket Server responded well, i think that means Established Connection to the Server im hosting.
But when accessed through the Client, i get the error specified 'No Connection could be made...'
Here is the Code that I use for Connection in Client :
private static void LoopConnect()
{
while (!_client.Connected)
{
try
{
IPAddress ip = IPAddress.Parse("**PUBLIC IP**");
IPEndPoint remoteEP = new IPEndPoint(ip,61911);
_client.Connect(remoteEP);
}
catch (SocketException e) { Console.WriteLine(e.Message); }
}
Console.WriteLine("Connected!");
}
And this Code that handles Accepting in the Server :
private static void SetupServer()
{
Console.WriteLine("Setting up Server.. ");
_server.Bind(new IPEndPoint(IPAddress.Any, 61911));
_server.Listen(4);
Console.WriteLine("Server UP!");
_server.BeginAccept(new AsyncCallback(AcceptCallBack), null);
}
private static void AcceptCallBack(IAsyncResult AR)
{
Socket socket = _server.EndAccept(AR);
_clients.Add(socket);
socket.BeginReceive(_buffer, 0, _buffer.Length, SocketFlags.None, new AsyncCallback(ReceiveCallback), socket);
_server.BeginAccept(new AsyncCallback(AcceptCallBack), null);
}
So i think thats all the information regarding the problem i can give ..
*Evrything regarding Malware Protection, Firewalls, Port Forwarding.. is done.
*And port is open in netstat -anb
Solutions appreciated :)
EDIT : The client sends request and then the server acknowledges. But i think that doesnt reach the client. For which i should do something else in the router like porting from 'inside'. How is that possible ???
Upvotes: 0
Views: 5380
Reputation: 33491
What happens is this:
To test your application, just use your local IP (192.168.1.2). when deployed, you can use the outside address. You could also open the port forwarding from the inside in your router, but that would be outside the scope of this answer.
Upvotes: 1