LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 12-04-2005, 09:54 AM   #1
tomazN
Member
 
Registered: May 2005
Location: Slovenia
Distribution: Suse 10.2 64bit
Posts: 127

Rep: Reputation: 16
I need some socket programing in C help


Is it possible to make a two way chat in C client - client, without having a server in between. It would be only suitable for comunication between two users not more. So socket to socket communication. I have done it in java but i have no ideer if this is even possible in C.

Maybe somebody can give me some usefull link, or maybe a simple example how this can be achived if it can be

Thx.
 
Old 12-04-2005, 10:46 AM   #2
FLLinux
Member
 
Registered: Jul 2004
Location: USA
Distribution: Fedora 9, LFS 6.3, Unbuntu 8.04, Slax 6.0.7
Posts: 145

Rep: Reputation: 15
You can have computer to computer chat in C. But one of the computers is going to have to be the server. Since you have to have someone accept the connect from someone else. If you wanted to just do it with out the server you could do it with UDP, and the two computers would only need to know the IP address of the other computer. But with UDP you are not guarantee that the data will get to the other computer.
 
Old 12-04-2005, 11:21 AM   #3
vivekr
Member
 
Registered: Nov 2005
Location: Coimbatore,India
Distribution: Fedora Core4
Posts: 68

Rep: Reputation: 15
Buddy,
I think chat is a system were both ends act as server and client.
In ur implementation in java I hope u had a streams(both ip and op) associated with sockets on either side thro which they share data and hence both act as said above.
 
Old 12-04-2005, 11:23 AM   #4
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
wit cht des he ccaionl doppd caratermater
 
Old 12-04-2005, 02:59 PM   #5
tomazN
Member
 
Registered: May 2005
Location: Slovenia
Distribution: Suse 10.2 64bit
Posts: 127

Original Poster
Rep: Reputation: 16
Yes i made it so in java (client was a server and vice versa). But i dont know so many C and so i dont know how exactly would i do that. Any help or example or anything appreciated.
 
Old 12-08-2005, 12:17 AM   #6
anandsba
LQ Newbie
 
Registered: Dec 2005
Posts: 7

Rep: Reputation: 0
Hi, I suggest you to read Beej guide. You can search for the same in the web.
 
Old 12-08-2005, 12:35 PM   #7
egag
Senior Member
 
Registered: Jul 2004
Location: Netherlands
Distribution: Slackware
Posts: 2,721

Rep: Reputation: 52
as said take a look at Beej's guide :

http://beej.us/guide/bgnet/output/htmlsingle/bgnet.html

you probably can use this too ( threads ) :

http://www.yolinux.com/TUTORIALS/Lin...ixThreads.html

egag
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
socket: Socket type not supported monindra Fedora - Installation 4 01-14-2008 08:25 AM
getpeername: Socket operation on non-socket KevStA Linux - General 5 04-26-2006 03:11 AM
cannot read data at server socket, though client socket sends it jacques83 Linux - Networking 0 11-15-2005 02:58 PM
Unable to connect to UNIX socket /tmp/.esd/socket error while using grip dr_zayus69 Linux - Software 4 08-23-2005 08:28 PM
Raw Socket Programing djgerbavore Programming 2 08-18-2004 01:58 PM


All times are GMT -5. The time now is 06:01 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration