Connecting Tech Pros Worldwide Help | Site Map

Sockets and filebuf with msvc 2003

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 22nd, 2005, 04:37 PM
Manfred Eckschlager
Guest
 
Posts: n/a
Default Sockets and filebuf with msvc 2003

Hi,

In Linux C++ there was an easy way to build a stream form a socket
like:

int sockFd = socket(AF_INET,SOCK_STREAM,0);

filebuf *netBuf = new filebuf( sockFd );
-and then
iostream *netStream = new iostream(filebuf);

But the new stream headers in VC.net 2003 dont support attach(int fd)
and filebuf(int) anymore.
Is there another short msvc like way to attach a stream to a socket?

thx, cheers
Manfred

  #2  
Old July 22nd, 2005, 04:37 PM
John Harrison
Guest
 
Posts: n/a
Default Re: Sockets and filebuf with msvc 2003


"Manfred Eckschlager" <eckschi@yahoo.com> wrote in message
news:4693bd71.0407190147.72695e59@posting.google.c om...[color=blue]
> Hi,
>
> In Linux C++ there was an easy way to build a stream form a socket
> like:
>
> int sockFd = socket(AF_INET,SOCK_STREAM,0);
>
> filebuf *netBuf = new filebuf( sockFd );
> -and then
> iostream *netStream = new iostream(filebuf);
>
> But the new stream headers in VC.net 2003 dont support attach(int fd)
> and filebuf(int) anymore.
> Is there another short msvc like way to attach a stream to a socket?
>
> thx, cheers
> Manfred[/color]

No short way in standard C++. If you want an VC++ specific answer then ask
on a VC++ group.

You should write your own stream classes for this sort of thing. It's not
that difficult, 'The C++ Standard Library' by Josuttis explains how.

john


  #3  
Old July 22nd, 2005, 04:38 PM
tom_usenet
Guest
 
Posts: n/a
Default Re: Sockets and filebuf with msvc 2003

On 19 Jul 2004 02:47:22 -0700, eckschi@yahoo.com (Manfred Eckschlager)
wrote:
[color=blue]
>Hi,
>
>In Linux C++ there was an easy way to build a stream form a socket
>like:
>
>int sockFd = socket(AF_INET,SOCK_STREAM,0);
>
>filebuf *netBuf = new filebuf( sockFd );
>-and then
>iostream *netStream = new iostream(filebuf);
>
>But the new stream headers in VC.net 2003 dont support attach(int fd)
>and filebuf(int) anymore.
>Is there another short msvc like way to attach a stream to a socket?[/color]

There is no standard way to do this, so it is off-topic for this
group; you should ask in an MSVC-specific newsgroup. (Hint,
std::filebuf::filebuf(FILE*))

Tom
 

Bookmarks

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.