Send data over a non-server socket.
Defined in <SDL_net.h>
int SDLNet_TCP_Send(TCPsocket sock, const void *data, int len);
TCPsocket | sock | the socket to send data to. |
const void * | data | a pointer to the bytes to send. |
int | len | the number of bytes, pointed to by data , to transmit. |
(int) Returns number of bytes sent, which might be less if there was a problem or connection failure. If the socket is invalid, this function can return -1, but in valid uses it'll return >= 0.
sock
must be a valid socket that was created by SDLNet_TCP_Open with a specific address, or SDLNet_TCP_Accept.
This function sends len
bytes, pointed to by data
over the non-server socket sock
.
This function returns the actual amount of data sent. If the return value is less than the amount of data sent, then either the remote connection was closed, or an unknown socket error occurred.
This function may block!
This function is available since SDL_net 2.0.0.