开发者

c# System.Net.Sockets.Socket.Connect() help

I am trying to develop, you guessed it, multiplayer networking. The first stage is to figure out if I can get a connection to my server. Whooptydoo, pot 80 works! :D

However, port 81, 90, 2700, 8092, and any other ports I try do NOT work.

Now, I have a feeling that this may be because there is nothing on the other end to accept my connection. Because th开发者_开发问答at is step TWO in figuring out networking (for me, anyways), I am hesitant to go there.

I've unblocked the port I want to connect to. (I've allowed both incoming, and outgoing TCP connections).

This is what I am using to start the socket:

s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp );

To connect:

s.Connect(hostEndPoint);

To create hostEnpoint:

hostEndPoint = new IPEndPoint(hostAddress, conPort);

I get no error exceptions, or anything like that. The code simply seems to freeze when it gets to connect().

I've tried blocking port 80, and then running the code to connect to 80, and the same thing happens.

So, am I any bit close as to what is wrong? Could it be something else? Do I need to make a program to ACCEPT connections on that port, and then run that on the server?

Thanks so much guys. :)


In this case, you may use the old Dos window (cmd.exe) and use the

telnet host port

command and check the error result. Connection refuse shows that there is no listener, Connection timeout indicates a firewall. Also check your individual Windows firewall for any blocking.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜