tag:blogger.com,1999:blog-1188765056128955958.post4781692574666937365..comments2023-05-17T14:37:46.383+05:30Comments on the insane techie: TCP in C (one server and multiple clients) Dhanoop Bhaskarhttp://www.blogger.com/profile/06123558027322013737noreply@blogger.comBlogger18125tag:blogger.com,1999:blog-1188765056128955958.post-29085725025463078652018-03-07T20:28:49.412+05:302018-03-07T20:28:49.412+05:30gcc tcpclient.c -o client
This command compiles &...gcc tcpclient.c -o client<br /><br />This command compiles "tcpclient.c" and saves the executable with file name "client"<br /><br />For execution "./client" can be used only if the name of the executable file generated on compiling the program is "client"Dhanoop Bhaskarhttps://www.blogger.com/profile/06123558027322013737noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-69385770014049790282018-03-07T20:22:50.918+05:302018-03-07T20:22:50.918+05:30You can use 122.0.0.1 only if the IP address of th...You can use 122.0.0.1 only if the IP address of the machine in which the server program is running is 122.0.0.1<br /><br />Dhanoop Bhaskarhttps://www.blogger.com/profile/06123558027322013737noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-63787687325218183572018-03-07T20:19:26.213+05:302018-03-07T20:19:26.213+05:30In TCP, you can only have one application listenin...In TCP, you can only have one application listening to the same port at one time (in the same machine/IP address). Dhanoop Bhaskarhttps://www.blogger.com/profile/06123558027322013737noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-91429402811370016982018-02-26T18:47:15.249+05:302018-02-26T18:47:15.249+05:30in the client terminal after writing ./client
it ...in the client terminal after writing ./client <br />it is showing that<br />no such file or directory is foundAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-3533772117482038752017-11-05T12:42:15.527+05:302017-11-05T12:42:15.527+05:30what happen if we use ip address 122.0.0.1what happen if we use ip address 122.0.0.1FrontEnd techhttps://www.blogger.com/profile/11335605559672691220noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-61509247899201579402017-09-24T10:07:18.656+05:302017-09-24T10:07:18.656+05:30how does the server diffrentiates between clienta ...how does the server diffrentiates between clienta if the port no and ip address are same?<br />Anonymoushttps://www.blogger.com/profile/02401938289872264926noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-80550565348947907192017-08-24T11:07:18.412+05:302017-08-24T11:07:18.412+05:30thanks its working finethanks its working fineHiteshPoshiahttps://www.blogger.com/profile/09434408121734931803noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-4203659561318776722017-05-09T15:21:17.434+05:302017-05-09T15:21:17.434+05:30yes its working good
thank you siryes its working good <br />thank you sirAnonymoushttps://www.blogger.com/profile/18318554604500588744noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-2756212651858169402017-04-01T20:40:15.428+05:302017-04-01T20:40:15.428+05:30--terminal 1--
gcc tcpserver.c -o server
./server
...--terminal 1--<br />gcc tcpserver.c -o server<br />./server<br /><br />--terminal 2--<br />gcc tcpclient.c -o client<br />./client 192.168.0.4<br /><br />--terminal 3--<br />./client 192.168.0.4<br /><br /><br />Replace 192.168.0.4 with the IP address of the machine in which the server program is running.Dhanoop Bhaskarhttps://www.blogger.com/profile/06123558027322013737noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-12802456422005824522017-02-03T11:52:20.911+05:302017-02-03T11:52:20.911+05:30i want to run it in ubuntu.. how to connect the se...i want to run it in ubuntu.. how to connect the server to multiple clients.<br />thank you in advanceJUROSHhttps://www.blogger.com/profile/04131444307084329086noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-72191991053738946832016-06-30T22:00:37.746+05:302016-06-30T22:00:37.746+05:30--terminal 1--
gcc tcpserver.c -o server
./server
...--terminal 1--<br />gcc tcpserver.c -o server<br />./server<br /><br />--terminal 2--<br />gcc tcpclient.c -o client<br />./client 192.168.0.4<br /><br />--terminal 3--<br />./client 192.168.0.4<br /><br /><br />Replace 192.168.0.4 with the IP address of the machine in which the server program is running.Dhanoop Bhaskarhttps://www.blogger.com/profile/06123558027322013737noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-54012705338851025842016-05-19T16:18:42.011+05:302016-05-19T16:18:42.011+05:30Thank you.. It works for us.Thank you.. It works for us.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-9903096188995722312015-08-21T17:35:43.574+05:302015-08-21T17:35:43.574+05:30we executed both client & server programs but,...we executed both client & server programs but, while we executing after giving corresponding ip address "Error connecting to the server" message is displayed.<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-72078978911957766052014-07-31T21:33:21.786+05:302014-07-31T21:33:21.786+05:30Hi,
Sorry for late reply!
Functions sendto() and r...Hi,<br />Sorry for late reply!<br />Functions sendto() and recvfrom() are MUST while using UDP. However you can use it in TCP also.<br />What distinguishes TCP from UDP is the following line of statement-<br />sockfd = socket(AF_INET, SOCK_STREAM, 0); //for TCP<br />sockfd = socket(AF_INET, SOCK_DGRAM, 0); //for UDPDhanoop Bhaskarhttps://www.blogger.com/profile/06123558027322013737noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-71528582217739749162014-05-23T15:43:12.580+05:302014-05-23T15:43:12.580+05:30this is not tcp.this is udp.u have used "send...this is not tcp.this is udp.u have used "sendto()" and "recvfrom()"Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-87593180014511382712014-05-19T23:30:01.555+05:302014-05-19T23:30:01.555+05:30Note that 192.168.0.4 is the IP address of the mac...Note that 192.168.0.4 is the IP address of the machine in which the server is running.Dhanoop Bhaskarhttps://www.blogger.com/profile/06123558027322013737noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-27142423061170457112014-05-19T23:28:59.854+05:302014-05-19T23:28:59.854+05:30--terminal 1--
gcc tcpserver.c -o server
./server
...--terminal 1--<br />gcc tcpserver.c -o server<br />./server<br /><br />--terminal 2--<br />gcc tcpclient.c -o client<br />./client 192.168.0.4<br /><br />--terminal 3--<br />./client 192.168.0.4Dhanoop Bhaskarhttps://www.blogger.com/profile/06123558027322013737noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-61294892281289999702014-05-03T11:24:25.761+05:302014-05-03T11:24:25.761+05:30how to execute this programhow to execute this programAnonymousnoreply@blogger.com