Can the function "connect()" & "listen() + accept()" be used with the same TCP port at the same time ?
Louie Chan
louie@unitednet.com.hk
Sat Mar 15 19:44:00 GMT 2003
Dear sir/madam,
Does anyone know if I can use the functions "listen() & accept()" after one successful TCP connection with the function "connect" ?
Please refer to the following concept codes !!
int sockfd, new_connect_fd;
sockfd = socket(domain, type, protocol);
connect(sockfd, sockaddr, addrlen); <--- connect() and connection successful !
listen(sockfd, backlog);
new_connect_fd = accept(sockfd, sockaddr, addrlen); <--- Can the accept() be used after using connect() ?
Thanks for your help !
Best Regards. Louie
More information about the Gcc-help
mailing list