• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1888
  • Last Modified:

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

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
dtivmk
Asked:
dtivmk
1 Solution
 
dtivmkAuthor Commented:
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

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now