Client socket sending data only one time.
holo via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Sep 24 07:20:37 PDT 2015
Hello
I'm trying to connect to server and send data, with such simple
client:
#!/usr/bin/rdmd
import std.stdio;
import std.socket;
import std.socketstream;
import std.process;
import std.conv;
import core.time;
void main()
{
char[1024] buffer = 0;
Socket client = new TcpSocket();
auto addrServer = new InternetAddress("localhost", 8080);
client.connect(addrServer);
while(1)
{
client.send(readln());
client.receive(buffer);
writeln(buffer);
buffer = 0;
}
}
It is working but only one time, when I'm trying to send again
(second loop of while) it's stooping on readln() but not sending
input data.
What am i missing here?
Thanks in advance for any help.
More information about the Digitalmars-d-learn
mailing list