LINUX programming

Moderators: ITA
Number of threads: 1339
Number of posts: 2924

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
chat program using linux networking Posted by dashchandan on 13 Feb 2009 at 2:03 PM
Hi everyone,
I have just started network programming on linux and i wrote some very basic client-server programs. My university has a lan and i thought it would be fun to write a chat program for the lan, but i dont know how to proceed, can anyone help me out?

Thanks
Report
Re: chat program using linux networking Posted by gustavo-serra on 19 Feb 2009 at 5:45 AM
Maybe you could fork your main process into two:

The father will read user input and send it through the socket.
The son will receive data and display it on the screen.

If I am right, you can't use the same socket for both son and father, as the file descriptor (the socket) is not shared among them. Each process (father and son) will open its own connection. You could also use a thread, which I think that would make your job a lot easier.

Anyway, it is an idea.
Good luck!
Report
Re: chat program using linux networking Posted by gustavo-serra on 19 Feb 2009 at 5:45 AM
Maybe you could fork your main process into two:

The father will read user input and send it through the socket.
The son will receive data and display it on the screen.

If I am right, you can't use the same socket for both son and father, as the file descriptor (the socket) is not shared among them. Each process (father and son) will open its own connection. You could also use a thread, which I think that would make your job a lot easier.

Anyway, it is an idea.
Good luck!
Report
Re: chat program using linux networking Posted by gustavo-serra on 19 Feb 2009 at 5:45 AM
Maybe you could fork your main process into two:

The father will read user input and send it through the socket.
The son will receive data and display it on the screen.

If I am right, you can't use the same socket for both son and father, as the file descriptor (the socket) is not shared among them. Each process (father and son) will open its own connection. You could also use a thread, which I think that would make your job a lot easier.

Anyway, it is an idea.
Good luck!
Report
This post has been deleted. Posted by sohbeti on 20 Feb 2009 at 12:23 PM
This post has been deleted.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.