Solved

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

Posted on 2008-10-05
1
1,790 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

Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
IPv4 Conversion for script 4 60
error with file_get_contents and unserialize 22 202
Testing DSL speed/internal netwrk speed, etc. 3 117
By pass website on ASA for Websense 4 103
Network ports are the threads that hold network communication together. They are an essential part of networking that can be easily ignore or misunderstood, my goals is to show those who don't have a strong network foundation how network ports opera…
Creating an OSPF network that automatically (dynamically) reroutes network traffic over other connections to prevent network downtime.
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…
Suggested Courses

759 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