函数功能是父子进程使用TCP socket进行通信,只需要把字符串显示出来,运行提示错误是
at line 176 connect ERROR: con_rtn = -1, errno = 22 Invalid argument
不知何故?
/*
*function : TCP communication with a forked subtask
struct sockaddr_un
{
sa_family_t sun_family; // PF_NUIX or AF_UNIX or AF_LOCAL
char sun_path[UNIX_PATH_MAX]; //name of path;
};
//usr/include/linux/socket.h
typedef unsigned short sa_family_t;
struct sockaddr //this is general structure;
{
unsigned short sa_family; //AF_xxx
char sa_data[14]; // 14 bytes of protocol address
};
//usr/include/netinet/in.h
struct sockaddr_in //internet socket, can convert between above and it;
{
short int sin_family; //address cluster
unsigned short int sin_port; //port number
struct in_addr; //ip address
unsigned char sin_zero[8]; //for the same size as struct sockaddr
};
struct in_addr
{