UNIX Socket read/write functions

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Feb 2005
Posts: 78
Reputation: nanodano is an unknown quantity at this point 
Solved Threads: 2
nanodano's Avatar
nanodano nanodano is offline Offline
Junior Poster in Training

UNIX Socket read/write functions

 
0
  #1
Apr 9th, 2007
Is there any way to read or write to a socket besides using the read() and write() functions. Is there any way to treat it like a stream and use the insertion/extraction operators (<< and >>)? The reason I ask is because with read I have to put an arbitrary size on the message to be read, but that can vary.
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 5,051
Reputation: John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold 
Solved Threads: 332
Team Colleague
John A's Avatar
John A John A is offline Offline
Vampirical Lurker

Re: UNIX Socket read/write functions

 
0
  #2
Apr 9th, 2007
>Is there any way to read or write to a socket besides using the read() and write() functions.
http://www.hmug.org/man/2/send.php
http://www.hmug.org/man/2/recv.php

>Is there any way to treat it like a stream and use the insertion/extraction operators (<< and >>)?
You'll need a C++ wrapper library. I don't know any off the top of my head.
"Technological progress is like an axe in the hands of a pathological criminal."

All my posts may be freely redistributed under the terms of the MIT license.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,413
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1470
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: UNIX Socket read/write functions

 
0
  #3
Apr 10th, 2007
Microsoft MFC has a c++ socket classes, but I hear it isn't very well liked. You might check boost libraries, it probably has something.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 1,089
Reputation: vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all 
Solved Threads: 164
vijayan121 vijayan121 is offline Offline
Veteran Poster

Re: UNIX Socket read/write functions

 
0
  #4
Apr 10th, 2007
socket++ is a library that i have used. it works resonably well. it has a distinct c++ feel about it;
sockets in the library have the same interface as the streams in the iostream library. here is the link:
http://www.linuxhacker.at/socketxx

Last edited by vijayan121; Apr 10th, 2007 at 11:31 am. Reason: change url to a better one
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC