#include "net_mod_server_socket.h" #include "net_mod_socket.h" #include "shm_mm.h" #include "dgram_mod_socket.h" void server() { // void *socket = dgram_mod_open_socket(); // ShmModSocket tt; ShmModSocket * m_socket = new ShmModSocket; // NetModServerSocket(5000, NULL); NetModServerSocket *serverSocket = new NetModServerSocket(5000, m_socket); serverSocket->start(); } void client(){ NetModSocket client("localhost", 5000); char buf[MAXLINE]; while (fgets(buf, MAXLINE, stdin) != NULL) { client.send(buf, strlen(buf)); } } int main(int argc, char *argv[]) { shm_init(512); if (argc < 2) { fprintf(stderr, "Usage: %s %s|%s\n", argv[0], "server", "client"); return 1; } if (strcmp("server", argv[1]) == 0 ) { server(); } if (strcmp("client", argv[1]) == 0) client(); }