Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int new_fd =0;
- new_fd = accept( server_fd, NULL, NULL );
- while( 1 ){
- // if I am doing read,write here I am able to accept multiple
- // requests from one client
- // I have also tried accept4() call mentioned inside man
- // tried with nc command too.
- }
- while(1){
- int new_fd =0;
- new_fd = accept( server_fd, NULL, NULL );
- // if I am doing read write here I am able to accept
- // only one request with one client
- // I thought my client does not work properly
- // so I also tried with nc command
- // same goes with accept4()
- }
- while(1){
- int new_fd =0;
- new_fd = accept( server_fd, NULL, NULL );
- if( fork() ==0 ){
- // if I am doing read, write here
- // I am able to accept one request from multiple clients
- // but one client is able to send only one request.
- // tried with accept4() and nc
- close( new_fd );
- }
- int socket_fd;
- socket_fd = socket( AF_INET, SOCK_STREAM, 0);
- // for socaddr_in.port port I have used htons()
- // for sockaddr_in.addr I have use inet_pton()
- connect(socket_fd(structsockaddr*)&socaddr_in,(socklen_t)
- sizeof(sockaddr_in));
- while(1){
- // here where I am using read, write, fflush(), memset() call.
- }
Add Comment
Please, Sign In to add comment