当前位置: 技术问答>linux和unix
Client 端,Server端源代码。
来源: 互联网 发布时间:2015-09-05
本文导语: 1,SErver端源码: #include #include #include #include #include #include #include #include #include #include #include using namespace std; type struct MSG{ Header head; Body body; } const int PORT = 1235; main(int argc , char ** argv){ ...
1,SErver端源码:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
type struct MSG{
Header head;
Body body;
}
const int PORT = 1235;
main(int argc , char ** argv){
int port = 0 ;
if(argc > 1){
port = atoi(argv[1]);
}
if(port == 0) port = PORT;
int sockfd = socket(AF_INET ,SOCK_STREAM , 0);
int on = 1;
if(sockfd
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
type struct MSG{
Header head;
Body body;
}
const int PORT = 1235;
main(int argc , char ** argv){
int port = 0 ;
if(argc > 1){
port = atoi(argv[1]);
}
if(port == 0) port = PORT;
int sockfd = socket(AF_INET ,SOCK_STREAM , 0);
int on = 1;
if(sockfd