replace the read and write calls with send and recv
This commit is contained in:
parent
fda6a3f215
commit
b31492b988
1 changed files with 2 additions and 2 deletions
|
|
@ -121,7 +121,7 @@ int main(int argc, char **argv)
|
||||||
// grab the client's socket information (not needed?)
|
// grab the client's socket information (not needed?)
|
||||||
// check to see if the client socket is actually connected (not needed?)
|
// check to see if the client socket is actually connected (not needed?)
|
||||||
// grab the data from the client, save to message.
|
// grab the data from the client, save to message.
|
||||||
messageBytes = read(fileIter, message, BUFFER_SIZE);
|
messageBytes = recv(fileIter, message, BUFFER_SIZE, 0);
|
||||||
// make sure that the connection is still open before attempting to send.
|
// make sure that the connection is still open before attempting to send.
|
||||||
if(messageBytes == 0) // old: messageBytes <= 0
|
if(messageBytes == 0) // old: messageBytes <= 0
|
||||||
{
|
{
|
||||||
|
|
@ -134,7 +134,7 @@ int main(int argc, char **argv)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if it is open, send the message back to the client over the client socket
|
// if it is open, send the message back to the client over the client socket
|
||||||
write(fileIter, message,messageBytes);
|
send(fileIter, message, messageBytes, 0);
|
||||||
printf("\nMessage has been sent back to client.\n");
|
printf("\nMessage has been sent back to client.\n");
|
||||||
}
|
}
|
||||||
printf("\nMessage received.\n");
|
printf("\nMessage received.\n");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue