Re: Log Out Issues

From: Alexander Nickolov (agnickolov_at_mvps.org)
Date: 09/03/04


Date: Fri, 3 Sep 2004 09:58:55 -0700

The reason UDP is preferred is because it does not implement
connection throttling, e.g. it does not limit the bandwidth to prevent
packet loss. However, there's no magic here - if you exceed your
bandwidth, your perormance may be worse than TCP. The trick
would be if your protocol anticipates packet loss and does not
need to retransmit a small percentage of the packets altogether.

Anyway, that's beyond your question. For connection termination,
use TCP's half close and the fin wait / time wait connection states.
See http://www.faqs.org/rfcs/rfc793.html page 36-37.

-- 
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
"Callum Winter" <callum@REMOVE_THISwinter9999.fsnet.co.uk> wrote in message 
news:%23IKmfFakEHA.3520@TK2MSFTNGP11.phx.gbl...
> Hi Alex,
>
> I would be quite happy to use TCP to save headaches, but from every source
> ive read during my learning, UDP is the way to go for internet games.
> Apparently the extra overhead in TCP can cause a lot more lag in your 
> game,
> especially in the MMORPG variety where a mass of data passing is required 
> to
> keep everything running.
>
> If you can confirm that these comments are out of date then ill move over 
> to
> TCP, but I ask why do most top online games use UDP for their protocol if
> TCP were better.
>
> I already have reliable/ordered/multithreaded communication, I just need
> help with this one logging out/message passing problem. I must at least 
> try
> the fastest method before I give in and move to the simpler but slower
> method of communication, as speed will effect the total number of players 
> I
> can have per hosting server.
>
> Do you know of any good resources that at least give some varied solutions
> to this problem.
>
> Your comments are appreciated.
> Callum.
>
>
> "Alexander Nickolov" <agnickolov@mvps.org> wrote in message
> news:uCCMa9TkEHA.2664@TK2MSFTNGP11.phx.gbl...
>> Any reason you are not using TCP instead of UDP? TCP handles
>> all these details already. If you want, you can implement TCP's
>> algorithms yourself of course, but what would be your gain from
>> that? TCP is implemented in the kernel thus it will be much more
>> efficient...
>>
>> -- 
>> =====================================
>> Alexander Nickolov
>> Microsoft MVP [VC], MCSD
>> email: agnickolov@mvps.org
>> MVP VC FAQ: http://www.mvps.org/vcfaq
>> =====================================
>>
>> "Callum Winter" <callum@REMOVE_THISwinter9999.fsnet.co.uk> wrote in
> message
>> news:%23PJ7Y4SkEHA.2340@TK2MSFTNGP11.phx.gbl...
>> > Hi all, hope someone can help.
>> >
>> > I just started to learn winsock 2 a few weeks back, and ive already
> wrote
>> > code to send and receive user datagrams.
>> > The code also performs ordering of incoming packets and sends ACKs for
>> > reliable messages.
>> > so that messages are resent until ACKS are received in reliable cases.
>> >
>> > Now all this works great but Ive come to a chicken and the egg problem
>> > with
>> > logging out.
>> >
>> > Lets say the client sends a log out request to the server reliably. The
>> > server then gets this and sends a log out confirm message to the client
>> > and
>> > delete that host from its local list.
>> >
>> > If the client receives the message all is well and the client cleans up
>> >
>> > If the log out confirm gets lost, the client will hang forever waiting
> for
>> > the server to send another, which will never happen cos the server
> deleted
>> > that host.
>> >
>> > Now i could make the server wait until it gets another reply back from
> the
>> > client saying it got the logout confirm before it deletes, but then how
>> > does
>> > the client know when to stop sending this info unless the server
> responds
>> > back which it wont do once it deletes that host, it will only send an
> ACK
>> > once. If that ACK doesnt get to the client, the client will send
> forever.
>> >
>> > This silly loop goes on and on and on.
>> >
>> > The only solution i can think of is to have the client time out after n
>> > seconds if it doesnt receive a log out confirm. Problem here is that 
>> > the
>> > reason it may not of received a log out confirm isa beacuse the server
>> > never
>> > got the log out request in the first place.
>> > So if the server never gets it and the client times out the server will
>> > still think they are logged in and never free up that slot in its list.
> So
>> > then you have to have a timer on the server etc etc.
>> >
>> > This is all very messy. Does anyone have any comments on the best 
>> > method
>> > for
>> > a player wanting to log out and how far to take the message back and
>> > forthing. In fact how has everyone else combatted this problem.
>> >
>> > Any ideas would be greatly appreciated.
>> > Thanks in advance.
>> > Callum.
>> >
>> >
>>
>>
>
> 


Relevant Pages

  • Re: Netzwerkproblem GBit -> 100MBit
    ... GBit-Kette - flow control zwingend notwendig sei. ... zwischen Client und Server. ... Das kann TCP an der Stelle nicht mehr leisten. ...
    (de.comp.sys.novell)
  • suspect bug in vge(4)
    ... The high-level view of the problem is that the client seems to stall ... HTTPS server. ... not only printed for TLS/SSL issues but simply also for broken TCP ... To me it sounds like a broken implementation of hardware generated ...
    (freebsd-current)
  • Re: Log Out Issues
    ... UDP is the way to go for internet games. ... Apparently the extra overhead in TCP can cause a lot more lag in your game, ... >> Lets say the client sends a log out request to the server reliably. ...
    (microsoft.public.win32.programmer.networks)
  • Re: [2.6.24.3][net] bug: TCP 3rd handshake abnormal timeouts
    ... server via TCP and non-persistent connections and all application level ... "Sometimes" when establishing a TCP connection to the server, ... Here is a simplified version of what _both_ the server and the client ...
    (Linux-Kernel)
  • Re: [2.6.24.3][net] bug: TCP 3rd handshake abnormal timeouts
    ... server via TCP and non-persistent connections and all application level ... "Sometimes" when establishing a TCP connection to the server, ... Here is a simplified version of what _both_ the server and the client ...
    (Linux-Kernel)