| | |
| | | #include <getopt.h> |
| | | #include "logger_factory.h" |
| | | |
| | | //测试传递函数指针 |
| | | |
| | | |
| | | void sendback(void ** buf, int *size){ |
| | | void sendback(void ** buf, int *size, void * user_data){ |
| | | char sendbuf[512]; |
| | | printf( "server: RECEIVED REQUEST FROM \n "); |
| | | sprintf(sendbuf, "RECEIVED REQUEST \n"); |
| | |
| | | int rv; |
| | | int key; |
| | | while(true) { |
| | | rv = net_mod_socket_recvandsend_timeout(ser, &recvbuf, &recvsize, &key, sendback, 2, 2000000 ); |
| | | rv = net_mod_socket_recvandsend_timeout(ser, &recvbuf, &recvsize, &key, sendback, 2, 2000000, NULL ); |
| | | if(rv == 0) |
| | | free(recvbuf); |
| | | } |