当前位置: 技术问答>linux和unix
socket 编程 运行正常 为什么netstat -an 还有 time_wait 的套接字?
来源: 互联网 发布时间:2015-09-04
本文导语: #include /* basic system data types */ #include /* basic socket definitions */ #include /* timeval{} for select() */ #include /* timespec{} for pselect() */ #include /* sockaddr_in{} and other Internet defns */ #include /* inet(3) functions */ #include...
#include /* basic system data types */
#include /* basic socket definitions */
#include /* timeval{} for select() */
#include /* timespec{} for pselect() */
#include /* sockaddr_in{} and other Internet defns */
#include /* inet(3) functions */
#include
#include /* for nonblocking */
#include
#include
#include
#include
#include
#include /* for S_xxx file mode constants */
#include /* for iovec{} and readv/writev */
#include
#include
#include
#define MAXLINE 20
int main (int argc , char ** argv)
{
int n;
int sockfd;
char reciv[MAXLINE+1];
struct sockaddr_in serv;
if (argc !=2 )
{
printf("argc !=2n");
exit(1);
}
if ( (sockfd = socket(AF_INET, SOCK_STREAM,0))
#include /* basic socket definitions */
#include /* timeval{} for select() */
#include /* timespec{} for pselect() */
#include /* sockaddr_in{} and other Internet defns */
#include /* inet(3) functions */
#include
#include /* for nonblocking */
#include
#include
#include
#include
#include
#include /* for S_xxx file mode constants */
#include /* for iovec{} and readv/writev */
#include
#include
#include
#define MAXLINE 20
int main (int argc , char ** argv)
{
int n;
int sockfd;
char reciv[MAXLINE+1];
struct sockaddr_in serv;
if (argc !=2 )
{
printf("argc !=2n");
exit(1);
}
if ( (sockfd = socket(AF_INET, SOCK_STREAM,0))