/* * High Speed modem to transfer data in a 2,7kHz SSB channel * ========================================================= * Author: DJ0ABR * * (c) DJ0ABR * www.dj0abr.de websocket server: based on the work by: Davidson Francis This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see */ #include "../hsmodem.h" extern int useCAT; int connections = 0; // a new browser connected void onopen(int fd) { char *cli; cli = ws_getaddress(fd); if(cli != NULL) { insert_socket(fd,cli); printf("Connection opened, client: %d | addr: %s\n", fd, cli); connections++; printf("%d users logged in\n",connections); free(cli); } } // a browser disconnected void onclose(int fd) { remove_socket(fd); #ifdef WIN32 _close(fd); #else close(fd); #endif printf("Connection closed, client: %d\n", fd); connections--; printf("%d users logged in\n",connections); } // if avaiable, send data to a browser int onwork(int fd, unsigned char *cnt0, unsigned char *cnt1) { int ret = 0; for(int i=0; i