Solved

Simple TCP IP Chat or Talk applicaiton (client and server) for cygwin/linux

Posted on 2008-10-05
1
1,778 Views
Last Modified: 2012-05-05
Hi,
Can someone point to the/or provide with the
simple client server code in C using sockets..
Code should be compilable with gcc on cygwin/linux.
the client and server should be able to send and receive messages
to each other and cancel the chat with ctrl-c or something similar...

I hope both the files put together will not be more than 80-90 lines of code..
0
Comment
Question by:dtivmk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
dtivmk earned 0 total points
ID: 22912839
It's simple actually.

client.c
sock1 = socket(..);
connect();
while(1)
{
printf("enter your message");
fgets();
write(sock1);
read();
}

server.c
socket();bind();listen;
sock2=accept();
while(1){
read();
printf("enter your message");
fgets();
write();
}
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
sonicwall change to allow viewing on device 3 28
How to prevent a legacy Domain controller from updating DNS 13 111
TCP connections per server 12 79
IIS7 FTP default folder 8 117
Article by: rfc1180
The Maximum Segment size (MSS) is an important consideration when troubleshooting connectivity via the Internet/Intranet. As the packets are routed via the Internet/Intranet, the packets must traverse through multiple routers in the path between two…
Configuring network clients can be a chore, especially if there are a large number of them or a lot of itinerant users.  DHCP dynamically manages this process, much to the relief of users and administrators alike!
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question