Solved

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

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Creating an OSPF network that automatically (dynamically) reroutes network traffic over other connections to prevent network downtime.
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!
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now