Solved

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

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

Simple, centralized multimedia control

Watch and learn to see how ATEN provided an easy and effective way for three jointly-owned pubs to control the 60 televisions located across their three venues utilizing the ATEN Control System, Modular Matrix Switch and HDBaseT extenders.

Question has a verified solution.

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

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…
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

623 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