|
From: Camille T. <ca...@os...> - 2011-09-30 15:53:47
|
Hey Stephen, On 30 sept. 2011, at 17:42, Stephen Sinclair wrote: > The server definitely does keep a list of sockets for incoming TCP > connections. I added this functionality so that connections could be > persistent, since previously they had to be closed and opened for > every OSC packet. That is good and works fine. > The address has one socket, and it may keep the socket open if it > doesn't notice yet that the other side is closed. This is the problem. What is weird though, is that this client socket prevents a server socket from being opened on the same machine. > There are often weird issues with waiting for sockets to time out. I don't know if > this is such a case. I don't know whether the address keeping the > socket open would stop a server from being able to bind that port for > receiving. Will have to test. OK, thank you very much Stephen. If you need more detail from me, please feel free to ask. >> Consider this scenario: >> >> - Client sends to Server >> - Server is closed >> - Client tried to lo_send -> results in an error. >> >> Now I can opened a new server on the same port. > > So you are saying that the address's socket is only closed when it > tries to send and notices that there is no longer a receiver-side > socket connected? Yes, this is what I see. I don't think this behavior is terribly wrong, it's just that I can't bind a server socket to the "hanging" port. >> Does it suggest that I should get rid of the lo_address every time a message has been sent? My application keeps track of lo_addresses and reuse them. > > That is the desired behaviour, hopefully you don't need to change your > application. :) > > In the above you describe that the lo_send fails when the server was > closed, wouldn't that imply that you only need to re-create the > lo_address only when lo_send fails, not every time you send a message? I don't even need to recreate a lo_address, it seems the socket is re-opened automatically by liblo, which is great. > In any case, I will try to review the retry logic in address.c. > Should it retry to open the connection at least once before reporting > failure, or is failure on connection closed a reasonable behaviour? No, unless it is required to solve the former problem. Best, Cam |