📄 main.cc
字号:
/**C++ tcp/ip and udp/ip library and example programmCopyright (C) 2002 Marcin Caban 'Cabko' and Borys Wisniewski 'Boria'This program is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2 of the License, orany later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.http://www.gnu.org/Marcin Cabane-mail: cabko@polsl.gliwice.plphone: +48 501 452 123Borys Wisniewskie-mail: boria@polsl.gliwice.plphone: +48 503 065 996*/#include <iostream.h>#include <unistd.h>#include "serverDemo.h"#include "clientDemo.h"/** Main function. \author Borys Wisniewski \date Fri Feb 8 23:52:03 2002 \todo make possibility to chat with other clients (now it can talk with %server - the %server can not talk to more than one %client - every connected %client talks with %server only) \todo change the program to use TCP/IP, now it uses UDP/IP \todo make a better user interface*/int main(int argc, char* argv[]){/* // char *command; char command[1024]; int i = 1; cout << "Starting Super Experimental X (SEX) Messaging program\n"; sleep (2); cout << "Type 'help' for help\n"; while (i == 1) { cout << ":) > ";// cin >> command; cin.getline ( command, 1024 ); if ( ! strcmp ( command, "send" ) ) { cout << "Enter user name:"; cin.getline ( command, 1024 ); cout << "Enter message:"; cin.getline ( command, 1024 ); cout << "Sending\n"; } if ( ! strcmp ( command, "read" ) ) cout << "Reading\n"; if ( ! strcmp ( command, "help" ) ) { cout << "send - send a message\n"; cout << "read - read recived message\n"; cout << "quit - quit program\n"; cout << "help - display this help\n"; } if ( ! strcmp ( command, "quit" ) ) { cout << "Bye Bye\n"; break; } }*/ switch (argc) { case 2: if (strcmp(argv[1],"server") == 0) { serverDemo server ("3999"); server.start(); } else { clientDemo client ("3999",argv[1]); client.start(); } break; default: cout << "RTFM!\n"; break; } return (0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -