Difficulty with write() [Linux] and recv() [Windows]

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a client socket connection (Linux) and a server socket connection
(Windows). All is fine with the sockets themselves.

The client-side is sending data (struct) to the server via write().
write(sockfd, &struct, sizeof(struct))

The server is receiving data via recv().
recv(clientfd, buf, sizeof(struct), 0)

Once data is received by the server, various verification checks are
performed via a 3rd-part app and the additional data is sent back to the
client, who writes the new data to a file.

I have been attempting to read the data being received, which is defined as
a char array ( char buf[sizeof(buf)]. Try as I might, I cannot seem to parse
this incoming data in any way as a string -- or struct, for that matter.

What am I doing wrong? Please!!!

I would gladly use the same socket functions as I have on Linux, but
read()/write() do not seem to be available in Windows. Or, at least I cannot
find them.

Please help me in resolving how I might convert this incoming stream of data
into structure elements.
 
Dennis said:
I have a client socket connection (Linux) and a server socket connection
(Windows). All is fine with the sockets themselves.

The client-side is sending data (struct) to the server via write().
write(sockfd, &struct, sizeof(struct))

The server is receiving data via recv().
recv(clientfd, buf, sizeof(struct), 0)

Once data is received by the server, various verification checks are
performed via a 3rd-part app and the additional data is sent back to the
client, who writes the new data to a file.

So, things works as expected on the server? But you can not parse the
response on the client?
I have been attempting to read the data being received, which is defined
as a char array ( char buf[sizeof(buf)]. Try as I might, I cannot seem to
parse this incoming data in any way as a string -- or struct, for that
matter.

It would help to see a snippet of the code you use to write to the stream on
the server side.

Regards,

Mads

--
Med venlig hilsen/Regards

Systemudvikler/Systemsdeveloper cand.scient.dat, Ph.d., Mads Bondo
Dydensborg
Dansk BiblioteksCenter A/S, Tempovej 7-11, 2750 Ballerup, Tlf. +45 44 86 77
34
 
Back
Top