Thread overview
Socket Listener and SocketStream
Mar 19, 2007
Patrick
Apr 17, 2007
jb
Apr 17, 2007
Lars Ivar Igesund
March 19, 2007
How do I use socketstreams? Any examples out there? (small ones!)
I've checked listener.d which seems to give some clue to sockets overall, but not enough for me to feel comfortable around them. :(
April 17, 2007
Patrick wrote:

> How do I use socketstreams? Any examples out there? (small ones!)
> I've checked listener.d which seems to give some clue to sockets overall,
> but not enough for me to feel comfortable around them. :(

I've been looking for some examples as well to no avail.

On a related matter, I've been playing around with listener.d for a while with telnet.  For some reason, be it a bug, feature, or just how it's supposed to work, I cannot reconnect to it.

Here's what steps I'm taking
-I telnet to listener
-Listener reports connection
-I type whatever, and listener outputs with a byte count
-I disconnect (escape key and quit telnet)
-Listener reports the disconnect.

At this point, if I were to attempt to connect to listener again,  the connection is not reported, nor does it display the characters being sent.

I've pin-pointed where the problem is, it doesn't get past:

foreach(Socket each; reads)
{
        sset.add(each);
}

the second time through.  If anyone knows why this occured or, even better, how to correct this so I can actually reconnect, please post.

Thanks,
-jb
April 17, 2007
Patrick wrote:

> How do I use socketstreams? Any examples out there? (small ones!)
> I've checked listener.d which seems to give some clue to sockets overall,
> but not enough for me to feel comfortable around them. :(

Tango has the similar SocketConduit, a few simple examples can be seen here:

http://www.dsource.org/projects/tango/wiki/SocketHelloExample

and

http://www.dsource.org/projects/tango/wiki/SocketFileCopyExample

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource, #d.tango & #D: larsivi
Dancing the Tango