Re: Server side command execution.

2015-09-28 Thread holo via Digitalmars-d-learn
On Monday, 28 September 2015 at 10:52:07 UTC, anonymous wrote: On Monday 28 September 2015 12:40, anonymous wrote: The client probably sends a newline; i.e. buffer[0 .. received] is "exit\n". Or more likely it's "exit\r\n". I changed condition to: if(to!string(buffer[0..received]) ==

Re: Server side command execution.

2015-09-28 Thread holo via Digitalmars-d-learn
On Monday, 28 September 2015 at 04:55:30 UTC, tcak wrote: On Sunday, 27 September 2015 at 23:56:10 UTC, holo wrote: Hello Im trying to execute commands on server side. Here is my server based on other example from forum: [...] You are comparing whole buffer to "exit" I changed my

Re: Server side command execution.

2015-09-28 Thread anonymous via Digitalmars-d-learn
On Monday 28 September 2015 12:40, anonymous wrote: > The client probably sends a newline; i.e. buffer[0 .. received] is > "exit\n". Or more likely it's "exit\r\n".

Re: Server side command execution.

2015-09-28 Thread anonymous via Digitalmars-d-learn
On Monday 28 September 2015 11:59, holo wrote: > I changed my condition to: > > if(to!string(buffer[0..received]) == "exit") > { > > break; > } > > > But it still dint help. The client probably sends a newline; i.e. buffer[0 .. received] is "exit\n".

Re: Server side command execution.

2015-09-28 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 28 September 2015 at 11:44:32 UTC, holo wrote: if(to!string(buffer[0..received]) == "exit\n") You shouldn't need that to!string by the way. I believe that will work just comparing the buffer directly. Converting to string is more important when you are storing a copy than just

Re: Server side command execution.

2015-09-28 Thread holo via Digitalmars-d-learn
On Monday, 28 September 2015 at 13:01:25 UTC, Adam D. Ruppe wrote: On Monday, 28 September 2015 at 11:44:32 UTC, holo wrote: if(to!string(buffer[0..received]) == "exit\n") You shouldn't need that to!string by the way. I believe that will work just comparing the buffer directly. Converting

Server side command execution.

2015-09-27 Thread holo via Digitalmars-d-learn
Hello Im trying to execute commands on server side. Here is my server based on other example from forum: #!/usr/bin/rdmd import std.stdio; import std.socket; import std.algorithm; import std.conv; void main() { Socket server = new TcpSocket();

Re: Server side command execution.

2015-09-27 Thread tcak via Digitalmars-d-learn
On Sunday, 27 September 2015 at 23:56:10 UTC, holo wrote: Hello Im trying to execute commands on server side. Here is my server based on other example from forum: [...] You are comparing whole buffer to "exit"