C++ Socket Programming (Recv and Send)

I'm having some troubles learning how to use send and recv to send something from one client to another.
I'll list some variables, and i'd much appreciate if someone could dearly help me figure how to send and recieve them.
I am currently working on a 2D MMO,
but i'm not sure how to send player positions.

player_x = 11;
player_y = 192;
send(how do i do this/what all goes here to send the data of player_(x/y))?
recv(how do i do this/what all goes here to recieve data from sent player_(x/y))?

This is my basic flaw.
The other problem i'm having is that i'm sure send and recv HAS to be a 'char' variable. If I wanted to send and recieve this as an intiger (without it still being a character), how would i do this?
it is a complex problem. how to send and receive data relies on the protocoll you want to use.

you may want to turn the the integers into one string (separated by a space). For that you can use stringstream or sprintf/sscanf

http://www.cplusplus.com/reference/sstream/stringstream/

http://www.cplusplus.com/reference/cstdio/sprintf/
http://www.cplusplus.com/reference/cstdio/sscanf/

to pack and unpack the data. you might use the 0 to determine the end of the data. i.e. read as long as a 0 appears. after that new data starts...
Topic archived. No new replies allowed.