Beispiel #1
0
GPResult
gpiSendOrBufferString(
  GPConnection * connection,
  GPIPeer_st peer,
  char * string
)
{
	return gpiSendOrBufferStringLenToPeer(connection, peer, string, (int)strlen(string));
}
Beispiel #2
0
GPResult
gpiPeerFinishTransferMessage(
  GPConnection * connection,
  GPIPeer * peer,
  const char * message,
  int len
)
{
	char buffer[32];
	GS_ASSERT(peer != NULL);
	if (!peer)
		return GP_NETWORK_ERROR;

	// Check the message.
	/////////////////////
	if(!message)
		message = "";
	
	if(len == -1)
		len = (int)strlen(message);

	// Set the len and the message.
	///////////////////////////////
	sprintf(buffer, "\\len\\%d\\msg\\\n", len);
	CHECK_RESULT(gpiSendOrBufferString(connection, peer, buffer));

	// Copy the message to the buffer.
	//////////////////////////////////
	CHECK_RESULT(gpiSendOrBufferStringLenToPeer(connection, peer, message, len));
	CHECK_RESULT(gpiSendOrBufferChar(connection, peer, '\0'));

	// Reset the timeout.
	/////////////////////
	peer->timeout = (time(NULL) + GPI_PEER_TIMEOUT);
		
	return GP_NO_ERROR;
}