library/src/network/BP-Network.cc
// Sends A Specified Number Of Bytes Across A Socket
Sends A Specified Number Of Bytes Across A Socket
Sends A Specified Number Of Bytes Across A Socket
int BP_NetSend(P_BP_NETWORK_HANDLE net_handle, char * data, int size)
{
	if(!net_handle)
		return -1;
	if(!net_handle->sock)
		return -1;
	if(!data)
		return -1;
	net_handle->last_send_counter = 0;
	int sendBytes = 0;
	sendBytes = send(net_handle->sock, data, size, 0);
	if(sendBytes <= 0)
		return -1;
	net_handle->last_send_counter = sendBytes;
	net_handle->total_tcp_send_counter += sendBytes;
	net_handle->total_all_send_counter += sendBytes;
	return sendBytes;
}
int BP_NetSend ( P_BP_NETWORK_HANDLE net_handle , char * data , int size ) { if ( ! net_handle ) return -1 ; if ( ! net_handle -> sock ) return -1 ; if ( ! data ) return -1 ; net_handle -> last_send_counter = 0 ; int sendBytes = 0 ; sendBytes = send ( net_handle -> sock , data , size , 0 ) ; if ( sendBytes <= 0 ) return -1 ; net_handle -> last_send_counter = sendBytes ; net_handle -> total_tcp_send_counter += sendBytes ; net_handle -> total_all_send_counter += sendBytes ; return sendBytes ; }
Sends A Specified Number Of Bytes Across A Socket
Sends A Specified Number Of Bytes Across A Socket
// no handle // no socket // no data // reset last send counter before doing anything // counter for send // send data over the socket // ensure we have valid send bytes // set the last send counter // increment the tcp total send counter // increment the total send counter // return the size written