digitalmars.D - IRC / std.sockets question
- APott (39/39) Jan 13 2014 Hello! I didn't really know if I should post here or not but I
- APott (1/1) Jan 13 2014 Perhaps this was in the wrong section, sorry about that.
- Adam D. Ruppe (9/11) Jan 13 2014 These lines are wrong: receive needs a pre-allocated buffer with
- APott (3/3) Jan 13 2014 Wow, that's actually incredibly embarrassing... I can't believe I
- Jakob Ovrum (6/12) Jan 14 2014 Is your project open source? I'm working on a standard-compliant
- Vladimir Panteleev (4/15) Jan 14 2014 I wrote an IRC server for a project a few weeks ago:
- Jakob Ovrum (4/7) Jan 14 2014 Do you intend to work on it or is it just going to be "good
- Vladimir Panteleev (4/14) Jan 14 2014 I wrote it for a specific purpose:
- Jakob Ovrum (12/16) Jan 14 2014 Cool, I didn't know WormNET used IRC. It's surprisingly common in
- Vladimir Panteleev (5/12) Jan 14 2014 Ah, I see. At the moment I'm not interested in continuing to
Hello! I didn't really know if I should post here or not but I decided I should try. I recently started reading up on the IRC protocol and thought I would try to mess with it a bit and see if I could implement a server with a few features, just for fun. I'm already having trouble... (I'm using the XChat client for testing) If I've read the various specifications of the IRC protocol correctly the client should be the first one sending data to the server, either the pass message or the nick message (if a user). (If this is wrong stop right here and let me know) With this assumption I was working with sockets and I'm failing to receive any data from the client, absolutely none. The connection is successful, the connection terminates when the socket is disposed of, I'm just getting absolutely no data from the client. Here's an example piece of code that would give this behavior: ``` Server.socket = new TcpSocket(); try { socket.bind(new InternetAddress(Server.port)); } catch (Exception e) { writeln(e.msg); return; } socket.listen(1); Socket client = socket.accept(); byte[] buffer; client.receive(buffer); writeln(buffer); client.shutdown(SocketShutdown.BOTH); socket.close(); socket.shutdown(SocketShutdown.BOTH); socket.close(); ``` Any suggestions, corrections, or help with this is very much appreciated! I'm very curious on this subject. (I feel like I'm doing something really wrong or something... sometimes it takes more than 2 eyes to see something simple
Jan 13 2014
Perhaps this was in the wrong section, sorry about that.
Jan 13 2014
On Tuesday, 14 January 2014 at 03:42:29 UTC, APott wrote:byte[] buffer; client.receive(buffer);These lines are wrong: receive needs a pre-allocated buffer with a certain size and it tries to fill it. Also generally ubyte is better for this than byte. ubyte[1024] buffer; auto got= client.receive(buffer); if(got < 0) throw new Exception("error"); if(got == 0) writeln("end of file) else auto receivedInfo = buffer[0 .. got]; /* use received info */
Jan 13 2014
Wow, that's actually incredibly embarrassing... I can't believe I didn't notice this, I knew I was missing something simple. Thanks for the help Adam!
Jan 13 2014
On Tuesday, 14 January 2014 at 03:42:29 UTC, APott wrote:Hello! I didn't really know if I should post here or not but I decided I should try. I recently started reading up on the IRC protocol and thought I would try to mess with it a bit and see if I could implement a server with a few features, just for fun. I'm already having trouble... (I'm using the XChat client for testing)Is your project open source? I'm working on a standard-compliant IRC client library for D called Dirk[1], and I'd love to follow progress on a server project. Perhaps Dirk can also aid you in testing :) [1] https://github.com/JakobOvrum/Dirk
Jan 14 2014
On Tuesday, 14 January 2014 at 08:05:53 UTC, Jakob Ovrum wrote:On Tuesday, 14 January 2014 at 03:42:29 UTC, APott wrote:I wrote an IRC server for a project a few weeks ago: https://github.com/CyberShadow/ae/blob/master/net/irc/server.d There is a client in the same package.Hello! I didn't really know if I should post here or not but I decided I should try. I recently started reading up on the IRC protocol and thought I would try to mess with it a bit and see if I could implement a server with a few features, just for fun. I'm already having trouble... (I'm using the XChat client for testing)Is your project open source? I'm working on a standard-compliant IRC client library for D called Dirk[1], and I'd love to follow progress on a server project. Perhaps Dirk can also aid you in testing :)
Jan 14 2014
On Tuesday, 14 January 2014 at 10:55:02 UTC, Vladimir Panteleev wrote:I wrote an IRC server for a project a few weeks ago: https://github.com/CyberShadow/ae/blob/master/net/irc/server.d There is a client in the same package.Do you intend to work on it or is it just going to be "good enough" for a specific purpose? It looks pretty gung-ho...
Jan 14 2014
On Tuesday, 14 January 2014 at 11:46:21 UTC, Jakob Ovrum wrote:On Tuesday, 14 January 2014 at 10:55:02 UTC, Vladimir Panteleev wrote:I wrote it for a specific purpose: https://github.com/CyberShadow/MyWormNET2I wrote an IRC server for a project a few weeks ago: https://github.com/CyberShadow/ae/blob/master/net/irc/server.d There is a client in the same package.Do you intend to work on it or is it just going to be "good enough" for a specific purpose?It looks pretty gung-ho...Sorry, I don't know what this expression means.
Jan 14 2014
On Tuesday, 14 January 2014 at 13:13:04 UTC, Vladimir Panteleev wrote:I wrote it for a specific purpose: https://github.com/CyberShadow/MyWormNET2Cool, I didn't know WormNET used IRC. It's surprisingly common in games.Sorry, I'm not sure what it means either :V I'm basically asking if it's intended as a library (or application) for use by others. The implementation seems to support a subset of IRC - which I assume are the bare necessities required for your application - and it seems to make no attempt to minimize GC garbage, have a const-correct API, strict input policy, documentation etc. The list goes on.It looks pretty gung-ho...Sorry, I don't know what this expression means.
Jan 14 2014
On Tuesday, 14 January 2014 at 13:42:46 UTC, Jakob Ovrum wrote:I'm basically asking if it's intended as a library (or application) for use by others. The implementation seems to support a subset of IRC - which I assume are the bare necessities required for your application - and it seems to make no attempt to minimize GC garbage, have a const-correct API, strict input policy, documentation etc. The list goes on.Ah, I see. At the moment I'm not interested in continuing to develop it as a general-purpose IRC server. Anyone's welcome to use it as a base or send pull requests, of course, and I can relicense it if MPL is not suitable.
Jan 14 2014