#include #include #include #include "trbase.h" #include "trcomm.h" #include "trio.h" #include "trevent.h" #include "test_handler.h" TR_INSTANCE(TR_LoggerSyslog, mylogger, {TR_LOGGER_INFO}); TR_INSTANCE(TR_LoggerStderr, mylogger2, {TR_LOGGER_INFO}); int main (int argc, char * argv[]) { TR_TcpSocket socket; TR_Connection connection; TR_SimpleClient client; TR_Protocol protocol; TR_ProtoMessageRaw message; TR_RemoteData data; TR_logger = TR_INSTANCE_CAST(TR_Logger, mylogger2); socket = TR_new(TR_TcpSocket, TR_logger, "192.168.2.13", 5678, 0); protocol = TR_new(TR_ProtocolRaw); connection = TR_new(TR_Connection, socket, protocol); TR_socketConnect((TR_Socket)socket); TR_socketNonblock((TR_Socket)socket); client = TR_new(TR_SimpleClient, connection); message = (TR_ProtoMessageRaw)TR_protoCreateRequest(protocol, (TR_Socket)socket); data = TR_new(TR_RemoteData, "test", sizeof("test"), (TR_Socket)socket); message->data = data; message = (TR_ProtoMessageRaw)TR_simpleClientIssue( client, (TR_ProtoMessage)message, 10000000); printf("%s\n", ((TR_SizedData)message->data)->data); TR_delete(message->data); TR_delete(message); puts("cleanup..."); TR_delete(client); TR_delete(protocol); TR_simpleClientClassCleanup(); TR_cleanup(); return 0; } // vim: set ts=4 sw=4: