Can't work with sockets
BCS
BCS at pathlink.com
Wed May 9 11:38:58 PDT 2007
Niovol wrote:
> Thanks. But I don't know how to receive messages real-time. And how to read all the stream. Can anybody help me?
>
you can use both str's like files streams*. they operate in real-time.
Think of them as data-pipes and you will be mostly correct. Data that is
written to one stream can be read from the other. The only potential
gotcha I known of is that it is all treated as one stream (no "messages"
or sections or whatever) so you need to find where things end your self.
If that doesn't cover it, I'll need to know more about what you are
doing to be of more help.
*http://digitalmars.com/d/phobos/std_stream.html
> BCS Wrote:
>
>>client side
>>Stream str=new SocketStream(new TcpSocket((new InternetAddress("whoever",port)));
>>
>>server side
>>
>>auto soc = new TcpSocket();
>>soc.bind(new InternetAddress("whoever", port));
>>soc.listen(1);
>>Stream str = new SocketStream(soc.accept());
More information about the Digitalmars-d
mailing list