Re: How to deal with sockets when client crashes.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Marek,

Wednesday, March 27, 2002, 3:42:23 AM, you wrote:

MZ> Hello,

MZ> In my transport protocol, which implements a 3-way handshake, I have the
MZ> following problem:

MZ> Let's say CLIENT 'C' from port 'c' tries to connect to SERVER 'S' to port
MZ> 's':

MZ> 'S' creates a new socket s1[s,c] in accept routine and hashes it.
MZ> Now 'C' and 'S' happily exchange data when suddenly 'C' crashes ('S'
MZ> doesn't know that and keeps s1 in the hash).

MZ> Then 'C' connects (using the same port c) to 'S', again, 'S' creates a new
MZ> socket in accept routine: s2[s,c]. But now, when they want to exchange
MZ> data, server doesn't know to which of its sockets socket put the data: s1
MZ> or s2? They are basically identical from the hash function's point of view.

MZ> How should I solve this problem? Should I check in accept whether there is
MZ> any ESTABLISHED socket with the same [s,c] and destroy it? Or maybe return
MZ> error from accept?
MZ> Thanks!

Lemme guess... Do you write a new protocol in order to implement such sort of
reconnection? Maybe you should expend application level of your protocol by
adding a command like "attach to dropped connaection by given hash number".

Thus, if 'C' connects at first, 'S' accepts it and sends an unique number
that should be used for recovering the connection after it was broken.

-- 
Best regards,
 Alexandr                            mailto:llb@udm.net.ru

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux