Server side:
------------
I have a binary file that I open with fopen("file", "rb")
I then do an fread of 1024 items into a u_char *packet (malloced).
I write the packet to the socket with a "send".
Client side:
------------
On the other end - I read the socket with a "recv" and fwrite the 1024 items
to a an open file (opened with fopen ("outfile", "wb").
I am getting the file onto the client side but it is messed up.
the server is on a Unix box (Solaris 2.6) and the client is on an NT 4.0 box.
What am I missing?
Any help appreciated and could you pl. respond to me directly?
Thanks.
PS: I guess my question is - what else gets done when you issue the "bin"
command at the ftp prompt.
-Hari
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Sockets-related functions are not part of the C language per se. This
question would be better asked in a newsgroup appropriate to your platform.
<< could you pl. respond to me directly? >>
Newsgroups are public forums. Why deprive readers of the solution to a
problem they may also face?
Paul Lutus
hko...@national.aaa.com wrote in message
<76bo4l$gl0$1...@nnrp1.dejanews.com>...
> Hi,
> I am trying to write binary data to a socket and am having problems at the
> other end.
>
> Server side:
> ------------
> I have a binary file that I open with fopen("file", "rb")
> I then do an fread of 1024 items into a u_char *packet (malloced).
> I write the packet to the socket with a "send".
>
> Client side:
> ------------
> On the other end - I read the socket with a "recv" and fwrite the 1024 items
> to a an open file (opened with fopen ("outfile", "wb").
>
> I am getting the file onto the client side but it is messed up.
> the server is on a Unix box (Solaris 2.6) and the client is on an NT 4.0 box.
>
> What am I missing?
> Any help appreciated and could you pl. respond to me directly?
> Thanks.
>
> PS: I guess my question is - what else gets done when you issue the "bin"
> command at the ftp prompt.
> -Hari
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
<Jack>
The C language does not define the send or receive functions you
mentioned, nor any interface to sockets at all. Sockets are very much
operating system specific, and Windows sockets are not exactly like
Unix sockets.
You need to ask about Unix sockets for Solaris in a Solaris group, or
news:comp.unix.programmer (but get their socket FAQ first), and NT
sockets in one of the newsgroups with "winsock" in its name.
</Jack>
--
Do not email me with questions about programming.
Post them to the appropriate newsgroup.
Followups to my posts are welcome.
> I am getting the file onto the client side but it is messed up.
> the server is on a Unix box (Solaris 2.6) and the client is on an NT 4.0 box.
>
> What am I missing?
The big-endian demon, the little-endian-rascal and the alignment-menace
mayhap?
kind regards,
Jos aka j...@and.nl