Skip to main content
gamedev.net
🔒 Locked

My server model

Started by Shadowed 2 replies 900+ views
Original Post
Shadowed
Shadowed
Hello guys This the approximate model of my server. It uses reliable UDP and the game style is click-based [e.g. clicked-here-done-this, clicked-there-went-there]. I would like to know if the overall design is bad and how many online users approximately can I have on a HT P4 server.
main()
{
Server.Init()
Network.Init()

CreateIncomingThread()
CreateOutgoingThread()

while(true)
{
ProcessQueue()
PushResultIntoOutgoingQueue()
}

}



IncomingThread()
{
if (PollForPackets())
{
SendBackACKPacket();
PushRequestIntoProcessingQueue()
}
}

OutgoingThread()
{
SendOutgoingQueue()
}

Many people told me that polling is always BAD. What''s the better alternative for this model? Thanks very much.
--I hate you.
SoulSpectre
SoulSpectre
Polling the udp interface for packets is bad, consider using blocking sockets etc.

Polling your message handler is alright though, hell most of the people who handle their windows messages in a winapp just poll it in a loop.
I see nothing wrong with that, the overhead for a poll once per frame is going to be negliable.
(I''m sure that this post is going to argued )
Shadowed
Shadowed
quote:
Original post by SoulSpectre
Polling the udp interface for packets is bad, consider using blocking sockets etc.

Polling your message handler is alright though, hell most of the people who handle their windows messages in a winapp just poll it in a loop.
I see nothing wrong with that, the overhead for a poll once per frame is going to be negliable.
(I''m sure that this post is going to argued )


Aren''t my sockets blocking already? I didn''t set them asynchronous or non-blocking anyhow..
or maybe I got you wrong
--I hate you.
Shadowed
Shadowed
Does the absence of replies mean that it''s perfect? *grin*
--I hate you.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.