Re: write vs send (& read vs recv)
From: David Schwartz (davids_at_webmaster.com)
Date: 11/26/03
- Previous message: Nimmi Srivastav: "TCP: write vs send (& read vs recv)"
- In reply to: Nimmi Srivastav: "TCP: write vs send (& read vs recv)"
- Next in thread: JustSomeGuy: "Re: write vs send (& read vs recv)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 25 Nov 2003 19:55:45 -0800
"Nimmi Srivastav" <nimmi_srivastav@yahoo.com> wrote in message
news:8b0c42d.0311251939.dbb9cf0@posting.google.com...
> I have a very simple socket program in which a TCP client sends a
> message to a TCP server. For some reason, when I use the write()
> library call, the server does not receive any message/data from the
> client. However, if I substitute the write() library call with the
> send() library call, everything works fine. I haven't tried the
> return path yet, but I suspect that I'll have to use recv() rather
> than read().
It's hard to imagine why this would be. Can you paste the code with
'write' and with 'send'? Maybe you just make a silly mistake in one and not
in the other. It's also possible some preloaded library does something
unusual with one and not with the other. The 'write' function should be
equivalent to 'send' with a flags value of zero.
> Does anyone want to guess what might be happening? What's the
> difference between write and send (& read and recv) for TCP sockets?
There are none on any UNIX that I know of, except that you can specify
options with 'recv' or 'send' that you can't with 'read' or 'recv'. Perhaps
you're using a very unusual operating system where sockets are not
interchangeable with file descriptors? Windows 98 is like this, but I don't
know of any BSD UNIXes that are at all like that.
DS
- Previous message: Nimmi Srivastav: "TCP: write vs send (& read vs recv)"
- In reply to: Nimmi Srivastav: "TCP: write vs send (& read vs recv)"
- Next in thread: JustSomeGuy: "Re: write vs send (& read vs recv)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]