LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-28-2010, 01:38 PM   #1
priya05
LQ Newbie
 
Registered: Sep 2010
Posts: 2

Rep: Reputation: -2
unix programming problem


help me to write c code of this problem

A simple TCP based chat server could allow users to use any TCP client (telnet, for example) to communicate with each other. For this question you should consider a single process, single thread server that can support exactly 2 clients at once, the server simply forwards whatever is sent from one client to the other (in both directions). Your server must not insist on any specific ordering of messages – as soon as something is sent from one client it is immediately forwarded to the other client. As soon as either client terminates the connection the server can exit
 
Old 09-28-2010, 02:02 PM   #2
rn_
Member
 
Registered: Jun 2009
Location: Orlando, FL, USA
Distribution: Suse, Redhat
Posts: 127
Blog Entries: 1

Rep: Reputation: 25
The info for both your homework assignments ...er... posts can be found here:

http://lmgtfy.com/?q=unix+socket+example
 
Old 09-28-2010, 02:10 PM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,659

Rep: Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970
Quote:
Originally Posted by priya05 View Post
help me to write c code of this problem

A simple TCP based chat server could allow users to use any TCP client (telnet, for example) to communicate with each other. For this question you should consider a single process, single thread server that can support exactly 2 clients at once, the server simply forwards whatever is sent from one client to the other (in both directions). Your server must not insist on any specific ordering of messages – as soon as something is sent from one client it is immediately forwarded to the other client. As soon as either client terminates the connection the server can exit
Don't post your verbatim homework questions here.
 
Old 09-28-2010, 02:19 PM   #4
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,236

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Quote:
Originally Posted by TB0ne View Post
Don't post your verbatim homework questions here.
I googled the homework question and the only hit was the answer key :P

http://www.cs.rpi.edu/~hollingd/netp...t1-answers.pdf

BEFORE REPORTING ME: if you actually look at it, it's for an old 2003 midterm that the faculty intentionally put up for students to study from. I see nothing wrong with linking to it. However, the OP should transfer to a school where the faculty doesn't engage in plagiarism.

Last edited by dugan; 09-28-2010 at 03:04 PM.
 
Old 09-29-2010, 09:53 PM   #5
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
Goes to show that the instructor is a lazy cheater as well... lame.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
unix programming problem priya05 Programming 3 09-28-2010 02:09 PM
problem in unix socket programming wagmare Linux - Networking 0 06-05-2009 05:53 AM
c programming in unix dilberim82 Programming 7 04-21-2004 04:32 PM
UNIX (Linux, BSD, etc) Programming :: UNIX kuphryn Programming 8 04-04-2004 11:50 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration