davidlkoenig

Members
  • Content count

    48
  • Joined

  • Last visited

Community Reputation

140 Neutral

About davidlkoenig

  • Rank
    Member
  1. Networking Books

    Actually, now that I think of it, there was one book that might be of interest to you. Though, I believe it's out of print now. (naturally) "Network Programming for Microsoft Windows" ISBN: 0735615799 You might Google for that... There's some decent info on it floating around out there.
  2. Networking Books

    Yeah the "TCP/IP Illustrated" volumes are also very good. Anything by Stevens is pretty much a classic text. (at least the first two volumes of any of his series) The Game Programming Gems series starting with book 3 has interesting information for sure. Game Coding Complete has a networking section. I believe that is in its 3rd edition at this point. Obviously that is going to be more game oriented than general. From my experience, there aren't a large number of really great books on network programming. The Stevens books along with online sources such as Beej's and MSDN seem to be about the best that really exists. (augmented by the forums here) One of the topics that Badgerr mentioned was IOCP, is which case Google can probably find as much info as is available, whether that be references to Boost::ASIO, or the native Win32 IOCP docs. "Google is your friend" etc... I've got quite a bit of things in storage right now, so I'll have to go through those when I get a chance. If I come across anything interesting, I'll forward it your way.
  3. Networking Books

    No one had answered the original question, even to suggest reading through the FAQ, so I thought I'd try to help. I made the assumption that the author of the original post read through the FAQ given that it's a sticky thread on the forums. I only mentioned the prior link as possibly useful, and you can never have enough information. Also, I don't see any listing for the book "Unix Network Programming" from searching the FAQ, so you might want to update it. [Edited by - davidlkoenig on July 20, 2009 7:59:56 AM]
  4. Networking Books

    I'm surprised no one actually responded to you on this one. The first book I would recommend for socket & protocol details/theory would be: Unix Network Programming, Vol 1 (3rd Edition) ISBN 0131411551 I realize that you're looking for more of a Windows focus. When it comes down to it, the base socket functions are primarily the same on all platforms. The Winsock specific things you'll most likely deal with initially are simply startup and cleanup functions. As a base, I would recommend that every network programmer have a copy of this book. I've also got a list of urls on my site which will point you to a bunch of other sites with actual useful info on them. http://www.gamenetworkprogramming.com/articles.html [Edited by - davidlkoenig on July 19, 2009 3:59:04 PM]
  5. udp error in VS2008

    Quote:Original post by vince35 Why shouldn't I bind to an arbitrary port on the client? And what does it do if I set the port to 0? I tried with the same result has before. So what you're saying is if I don't bind, the first send to will automatically do it for me? If so, then the system will decide a port number for me and that port number would be valid for answering from the server. Is that right? That might work. But then on the server, I have exactly the same problem. In that case, I really have to preset a port number and to bind it. Otherwise I won't know where to send the data to on the client. The server will do the same error has if it receives data in recvfrom when it's time to clean up the port or to exit the program. Regarding the way to send data, I fully agree with you. It was made this way just for the demonstration. Any other ideas? 1. There's nothing technically wrong with binding the port manually on the client, it's just common practice to let the system do the work for you, and it ensures that you don't bind to a port that's already in use. Passing in 0, results in the same as not binding. The system gives you an available port and binds it for you. It's a good way to keep yourself out of trouble. Obviously on the server you must bind in order for clients to know which port to broadcast to. 2. *nod* How are you pulling the data back out on the server side? Can you post your recvfrom() call? 3. Since the sendto()/recvfrom() call are causing you the issues, I was suggesting looking at the parameters you're passing in. Seems the most likely case for some sort of mix-up. Since you're passing strings around, what are your project settings in terms of "character set"? (not set, multi-byte, unicode, etc...) Not sure if vc2008 changes the properties dialog on this, but it should be located in "Configuration Properties"->"General". If you pass in a simple struct instead of a string, do you still get the issues? example: struct t_data { int n; }; ... t_data data; data.n = 1; sendto(s, (char*)&data, sizeof(t_data), 0, (PSOCKADDR) &remote_addr, sizeof(SOCKADDR_IN));
  6. udp error in VS2008

    You generally shouldn't bind to an arbitrary port on the client. Either set the port to 0 before you bind, or don't bind, and it will automatically bind when you do your first sendto(). The server will know where to send the packet from the address returned from recvfrom(). The port information for the client will be available there. I would say, look at the parameters in your sendto call. Instead of passing a const char* straight in, trying passing in a char* mystring = "bleh" and do a strlen(mystring) for the data length param. That can help keep you out of trouble.
  7. MMOPRG database

    Quote:Original post by Kylotan I think it was Dark Age of Camelot that basically just used a database to store a BLOB of player data much like saving it to a file. :) Not exactly using it entirely as intended, but it worked well enough for them. GuildWars uses a similar system. Here's an article on that: http://www.dbms2.com/2007/06/09/the-database-technology-of-guild-wars/
  8. Using ping to correct for lag?

    Here's a link that might add some useful info: http://trac.bookofhook.com/bookofhook/trac.cgi/wiki/IntroductionToMultiplayerGameProgramming?#ConnectionQuality
  9. Multithreading in UDP

    Quote:Original post by hplus0603 If you only have one network interface, there is no reason to use a thread for UDP messaging. One case in which threading makes sense is the following; Say your game switches/loads a new map at the end of every match. If this takes 10 seconds on the host, and say 30 seconds on some of the slower clients(or the reverse), this could cause either side to decide to time out if you weren't sending/receiving heartbeat or keep-alive packets. Threading here allows you to keep a constant flow of packets going regardless of what the rest of the system is doing.
  10. Lowering Pings

    Just do a quick search for TCP_NODELAY.
  11. Why are you creating more than one socket? Generally the server only needs to create one for UDP unless you're servicing multiple listening ports. You normally want to talk to the client on the same socket in which he established contact.
  12. MMORPG troubles

    Sounds to me that the problem is likely that you don't have a way to differentiate the different users on the incoming connections. All requests are treated as "user 1". How are you going about handling the inbound packets? How do you know "user 1" from "user 2"?
  13. handling multiple UDP sockets

    Quote:Original post by md_lasalle But the main question is, when do you need to bind ? , cause now my client is talking to itself instead of sending to the current host :'( You only need to bind when you want to listen on a specific port, such as your server. The client doesn't need to know which port he sends from. The server will need to send replies back to the client packet's source port. Edit: That statement is misleading... You only need to bind to a SPECIFIC PORT if you're running a server.. The client should pass in 0 as the port to bind.
  14. Getting a computer's name?

    The cross-platform base equivalent of GetComputerName() is gethostname(). This should work on any platform using the BSD sockets API. Winsock implements this function as well.
  15. Getting a computer's name?

    Basically I think this is what you want to do: 1. server starts up and starts listening for incoming packets 2. client sends a broadcast packet asking for any currently running games 3. server responds to the client In step 3 you have a couple options. You can have the server send his name in the reply packet, or you could have a step 4 where the client then uses gethostbyaddr() to get the hostname (you may need to use the equivalent winsock function). My guess is that you're going to want a better description of the currently running game session. The hostname alone doesn't really tell you much. So, it would probably be better to use the Windows API functions, or allow the server to set his own information for that gaming session.