当前位置: 技术问答>linux和unix
我写了一个linux下的socket(服务器\客户端)+多线程的小程序,可是服务端总是收不到东西,哪个高人帮我看看
来源: 互联网 发布时间:2016-02-11
本文导语: //Server #include #include #include #include #include #include #include #include #include #include #include #include #define SERVPORT 16200 /* server listen port */ #define BACKLOG 5 /* max number of linking at a time */ #define BUF 100 int...
//Server
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define SERVPORT 16200 /* server listen port */
#define BACKLOG 5 /* max number of linking at a time */
#define BUF 100
int main()
{
void* tcp_thread (void* );
int sockfd,client_fd; /*sock_fd:listen socket;client_fd:data transport socket */
int on=1;
struct sockaddr_in my_addr; /* information of server address */
struct sockaddr_in remote_addr;/* information of client address */
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0))
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define SERVPORT 16200 /* server listen port */
#define BACKLOG 5 /* max number of linking at a time */
#define BUF 100
int main()
{
void* tcp_thread (void* );
int sockfd,client_fd; /*sock_fd:listen socket;client_fd:data transport socket */
int on=1;
struct sockaddr_in my_addr; /* information of server address */
struct sockaddr_in remote_addr;/* information of client address */
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0))