PDA

View Full Version : tcp sending problem - socket returns without first checking


jeff
05-27-2003, 07:37 AM
hi guys, i'm trying to write a client app that does reliable transmission. ie. if the server goes down, the client should keep on trying to transmit until the data gets sent.

sure tcp does reliable transmission, but somehow perl (that's what i'm using)'s send() function always returns even before the actual data gets put onto the wire. This means that if i disconnect the server, the send() will still return as if the data has been sent! The error will only be detected after a few packets, but that's ridiculous.

does anybody know of any modules that i can use? i've tried eg. Net::Telnet, but the same thing happens.

dev
05-27-2003, 01:37 PM
ur first para seems to be a bit contradictary - reliable transfer and if server goes down how come data can be transferd to it!!!???

on second para, well in my last post , i had the answer as use setsockopt().i have not tried it out , but Michael says so, so it will help. set less timeouts and it may help.

RobSeace
05-27-2003, 05:22 PM
It's not just Perl's send() that does that; you'd find that C's send(),
and well ANY language's send(), I imagine, would do the same
thing... That's just the way it works... You are just writing data
into your send queue, which will be actually transmitted at some
later point in time, when your system's TCP/IP stack feels like
doing so... You have no control over the process; TCP is the
one responsible for reliable delivery of data... Believe me, if IT
can't get the data there, there's no way YOU are going to, on
your own, either... But, if you really want that sort of control,
well don't use TCP... Because, TCP specifically takes away
that control from you, so that IT can handle it...