Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Some winsocket questions

This topic is 5813 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

1. Where can i find a good, and small non-block chat server souce code? 2. When using bind: int bind( SOCKET s, const struct SOCK_ADDR *name, int namelen ); i have read in several diffrent tut that you call it like this: bind(some_socket,(LPSOCKADDR)&addr,sizeof(addr); why the LPSO..... thing ? 3. How can i read the packet header ?

Share this post

Link to post
Share on other sites

1. Check out google.com and search for "chat server source Winsock". That should get you plenty of hits.

2. The (LPSOCKADDR) is just a type cast. Basically all LPSOCKADDR is is a typedef for (SOCKADDR *). The cast is required because of legacy issues with the way BSD socket address structures are named and formatted to support various protocols (namely UNIX domain sockets). Not a lot to know, except that you have to do it.

3. Explain what you mean by packet header. To which protocol layer are you referring? You can access the TCP segment headers by using raw sockets. You can access UDP packet headers the same way I believe. I''ve never had much reason to do either, unless I''m writing a packet sniffer. Even then, there are some nice libraries out there already to handle all of that...

Hope this helps.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!