473,394 Members | 1,701 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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
Jul 22 '05 #1
2 1790

"Manfred Eckschlager" <ec*****@yahoo.com> wrote in message
news:46**************************@posting.google.c om...
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


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
Jul 22 '05 #2
On 19 Jul 2004 02:47:22 -0700, ec*****@yahoo.com (Manfred Eckschlager)
wrote:
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?


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
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Syver Enstad | last post by:
I've downloaded both source distro, and binary installer. Installed python with the binary installer, when I attempted to compile mxDateTime (mxBase) for 2.3 with MSVC 6.0 I got an error that...
2
by: Maya | last post by:
Apart from being a pointer, what would be the benefit of using 'std::filebuf' than using the std::fstream? As far as I can see, I would use the same methods in 'filebuf' that I would when using...
6
by: Laxmikant Rashinkar | last post by:
Is there any way to use a C# socket in promiscuous mode? Any sample code that shows how this is done? any assistance is much appreciated! thanks LK
0
by: 3doutpost | last post by:
(apologies for the new thread - for some reason google news doesn't give me the option to reply to an earlier vcbuild.exe thread) I'm trying to build a C++ project that was originally created in...
8
by: Chris Stankevitz | last post by:
I can't tell you how frusterated I and my coworkers are with "MSVC 7.1 .net 2003" (what am I supposed to call this thing anyway?). Compiling and linking take twice as long with "MSVC 7.1 .net...
1
by: nitroamos | last post by:
i'm working on improving the IO for the software project i'm working on to do two extra things. first, i'm going to add HDF5 functionality, and second, add the ability to write binary output. the...
3
sangeetha jagannathan
by: sangeetha jagannathan | last post by:
hi can anyone explain me this code, instruction by instruction. i am not able to follow it. #include <iostream.h> #include <fstream.h> #include <stdio.h> #include "logger.h" #include...
1
by: SpreadTooThin | last post by:
I am simply trying to see if I am at the end of a file... In my class I maintain a filebuf. In my class I want to provide a method to see if i am at the eof... My question is can I...
2
by: BruceWho | last post by:
I downloaded boost1.35.0 and built it with following command: bjam --toolset=msvc-7.1 --variant=release --threading=multi -- link=shared --with-system stage and it failed to compile, error...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.