Hello, Guys!
So I've got a Socket Server and Client set up right now.
Currently, It does listen for a connection, and if the Server is running,
The Client says so.
What I'm trying to do is simple.
Just a little test-run of sending out data to one-another.
Here is what I currently have:
1 2
|
char* hey = "Hello!";
send(socket,hey,4,0);
|
and
1 2 3
|
char* hey;
recv(socket,hey,4,0);
cout << "\nThe client says: " << hey;
|
As you can see, I have the Client send hello to the server,
In which the server respondes "Hello!".
Although this looks great, It doesn't work.
What happens is that when I connect to the server, the server does everything it should, then right after saying "The client says: " (But before saying "Hello!") the server app window freezes and asks to close it.
Which means it's not recieving properly.
If there something i'm doing wrong that I should be aware of?
I am a little drowsy on the send and recv funtions.
Here is what I understand of them:
send(Send to the socket of the server, Send the char of 'hey', bytes of data, 0);
and
recv(Recieve from the socket of the client, recieve the char of 'hey', bytes of data, 0);
Surely i'm doing something wrong. A response would be great!