Allocate and init the global stuff. */
| 114 | |
| 115 | /* Allocate and init the global stuff. */ |
| 116 | void initChat(void) { |
| 117 | Chat = chatMalloc(sizeof(*Chat)); |
| 118 | memset(Chat,0,sizeof(*Chat)); |
| 119 | /* No clients at startup, of course. */ |
| 120 | Chat->maxclient = -1; |
| 121 | Chat->numclients = 0; |
| 122 | |
| 123 | /* Create our listening socket, bound to the given port. This |
| 124 | * is where our clients will connect. */ |
| 125 | Chat->serversock = createTCPServer(SERVER_PORT); |
| 126 | if (Chat->serversock == -1) { |
| 127 | perror("Creating listening socket"); |
| 128 | exit(1); |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | /* Send the specified string to all connected clients but the one |
| 133 | * having as socket descriptor 'excluded'. If you want to send something |
no test coverage detected