Advertisement

socket

Started by September 25, 2002 11:04 PM
32 comments, last by Tran Minh Quang 22 years, 4 months ago
The first 1024 ports are "reserved" for specific protocols. That doesn''t mean you can use them locally, but don''t expect them to work they way you want them to on the global network.

For example - port 80 is reserved for http, port 21 for ftp and so on. There are a lot of places on the web where you can find lists that correlate ports with their expected protocols. However, it''s probably a little too soon for you to get into the details of protocols. That is is two or three steps further into the endeavor.

Another tool that might help you get a feel for the way a Windows machine uses tcpip ports is called "TCPView" and is available for free from SysInternals. What TCPView does is to list all of the open ports currently used by your machine. You might be surprised at how much tcpip activity goes on without your knowledge.

There are a lot of useful and interesting freeware utilities at that site too - so be certain to take a look around while you''re there.

"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
First off, if the call to socket is your first function call, then that''s wrong. You must call WSAStartup before any other winsock function.

Second, you say you''re connecting to 0.0.0.0 - this is wrong, you should be connecting to 127.0.0.1.

Finally, you don''t need to call bind in you client application. If you don''t, the connect will just pick a random free port and bind to that. The connect call should of course specify the port the server is listening on (5000 in your case)

If I had my way, I''d have all of you shot!


codeka.com - Just click it.

Advertisement
I will try it tonight. Thanks so much!
I will tell you my progress tomorrow
It works now!!!!!!Thank you
What''ve change is:
- change IP address of server to 127.0.0.1
- remove bind() function from Client program
- and INADDR_ANY to IP address of server Socket
And it works.

I want to make a simple demo using this socket program like this: Now i''ve finished a chess games (using DirectDraw) Human vs Computer. Now i wonder if it is possible to make it possible to player from 2 different computers? I mean Computer vs Computer!

This topic is closed to new replies.

Advertisement