From: Jean Tourrilhes <jt@bo...> - 2002-12-05 22:52:38
Alain Paschoud wrote :
> I send a file through OBEX on PPP. Obex is waiting on port 650
> (inet). When the file is completely recieved, I use function
> "OBEX_Cleanup". Then, I restart OBEX on port 650.
> The problem is that port 650 has not been freed. If I look with
> netstat, I have :
> tcp 0 0 192.168.1.1:650 192.168.1.2:1469 TIME_WAIT
> So I can't register server on port 650.
> After about 30 seconds, the port become free (a timeout somewhere),
> and my program can register server on port 650, and I can receive
> new file.
I bet that's a kernel/TCP thing.
I believe it's because when you close a socket, the other end
might not know immediately about it and might continue to send
data. If you were able to open the socket immediately, you might
receive this old data.
There might be a sysctl in the TCP stack controlling that, but
I guess you will have to live with it.
> I don't use any option like "OBEX_FL_KEEPSERVER", and on the other
> side, I use obex_tcp utility which I think do things correctly. What
> should I do to get port 650 free at once ?
The OBEX_Cleanup() call close both sockets if they are open,
so OBEX_FL_KEEPSERVER would not be a problem.
I believe your only option is to use the "accept" support of
the library (which mean OBEX_ServerAccept() & OBEX_FL_KEEPSERVER),
which was introduced for this reason. Please check the source code of
my e-Squirt library to see how to use that.
Get latest updates about Open Source Projects, Conferences and News.