[prev in list] [next in list] [prev in thread] [next in thread] 

List:       boost-users
Subject:    [Boost-users] Socket and iostream
From:       Ivan LAURETTE <ivan.laurette () laposte ! net>
Date:       2006-11-07 13:33:33
Message-ID: loom.20061107T142239-948 () post ! gmane ! org
[Download RAW message or body]

Darwin 8.8.0
Boost 1.33.1
gcc 4.0.1

Hello,

I want to establish a SMTP connection through a socket, then dialog with the
server using a stream. I thought I could to it like this:
//--------------------------------------------
#include <boost/iostreams/stream.hpp>
#include <boost/iostreams/device/file_descriptor.hpp>

using namespace std;
using namespace boost::iostreams;

...
int theSocket = socket(AF_INET,SOCK_STREAM,0);
connect(theSocket, ...);
	
file_descriptor fdDevice(theSocket);
stream_buffer<file_descriptor> fdstream(fdDevice);
iostream os(&fdstream);

string answer;
getline(os, answer);
cout << answer << endl;
os << "HELO xxxxx" << endl;
getline(os, answer);
cout << answer << endl;
os << "MAIL FROM: <xxx.xxx@xxx.xxx>" << endl;
getline(os, answer);
cout << answer << endl;
...
//--------------------------------------------
But nothing seems to be written nor readen to/from the socket except for the
first getline. What am I doing wrong here ?

Thanks in advance for any help.




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic