在服务端是建立侦听套接字,参数中,最后一个不为0。
在客户端是直接和服务端连接,参数中,前两个参数第一个是服务端的ip地址,第二个是要连接的服务端的端口。
doconnect()
fprintf(stderr,"in doconnect ,listen socket nnetfd = %d.\n",nnetfd);
if (o_listen)
return (nnetfd); /* thanks, that's all for today */
dolisten()
fprintf(stderr,"in dolisten lp = %d\n",lp);
/* Pass everything off to doconnect, who in o_listen mode just gets a socket */
nnetfd = doconnect (rad, rp, lad, lp);
fprintf(stderr,"in dolisten nnetfd = %d\n",nnetfd);
G:\nc\nc114-debug>nc -lp 66
in res_init
after recycle
after go: x now , optarg 0 optind 3
curport = (null)
in dolisten lp = 66
in doconnect
in doconnect ,listen socket nnetfd = 1864.
in dolisten nnetfd = 1864