Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Feb 2008
Offline Last Active Jun 13 2014 08:06 PM

Posts I've Made

In Topic: MMO Server questions

15 December 2013 - 04:20 PM

Also, when you start talking about large scale applications (MMO*), you probably should start studying distributed computing, load balancing, and IPC concepts in depth first before diving in. These are pretty advanced topics, and creating efficiently scaling systems is very difficult. It may also help to move from the mindset of one monolithic server process controlling the game to thinking in terms of multiple modular programs running in parallel to spread the work load.

In Topic: MMO Server questions

15 December 2013 - 01:54 PM

Not to mention that Windows servers tend to be more expensive for running the same tier of hardware compared to Linux on EC2.

In Topic: [solved] Calling recv() in a loop

15 December 2013 - 02:00 AM

Thanks, that clears up my question. The protocols I'm using are just based around arbitrarily-length string messages separated by delimiters; message size is not communicated by any process. I've been burnt quite badly in the past by assuming that TCP preserves packet boundaries, hence the rotating buffers. :P


I've just never seen anybody else do it that way.

In Topic: [solved] Calling recv() in a loop

15 December 2013 - 12:34 AM

Ah thanks. That code was made up for this thread for simplicity's sake, the actual code does use select() and handles the memory buffers. The strategy I'm using is to keep a linked list of buffers per connection, where each recv() reads data into a new buffer, and if any data is written it is added to the end of the linked list. The buffers are freed when the parser processes the list later. According to the man pages for recv(2):



All three routines return the length of the message on successful  completion.   If  a  message  is  too  long to fit in the supplied buffer, excess bytes may be discarded depending on the type of socket the message is received from.



But it doesn't say which. And since I've been having networking-related bugs, I want to make sure that I'm not accidentally dropping data while not being susceptible to buffer overflow bugs/exploits. Blocking isn't too much of an issue; the program is supposed to be a daemon anyways. The program is connecting to game server instances, which may stream small or large amounts of data, and connecting to admin tools, which stream short commands. However, there is no set packet size, so I want to know if I can play it safe by reading from a socket into a growing list of buffers until it is dry.

In Topic: The Joys Of Nesting

11 August 2013 - 02:45 PM

Excessive code!


But on a serious note, I've been taught a rule of thumb that whatever reduces complexity tends to be the lesser evil.