Re: `Socket.receive` providing arbitrary packet sizes and hanging without sending EOF

2017-12-13 Thread Ali Çehreli via Digitalmars-d-learn
On 12/13/2017 11:39 AM, Unazed Spectaculum wrote: > ubyte[] receiveBytes(T)(T socket, size_t receiveCount) > { > ubyte[] buffer = new ubyte[receiveCount]; > size_t count = socket.receive(buffer); Don't trust code you find on newsgroups. :o) You have to check the returned value first. A

Re: `Socket.receive` providing arbitrary packet sizes and hanging without sending EOF

2017-12-14 Thread Unazed Spectaculum via Digitalmars-d-learn
On Thursday, 14 December 2017 at 00:09:39 UTC, Ali Çehreli wrote: On 12/13/2017 11:39 AM, Unazed Spectaculum wrote: > ubyte[] receiveBytes(T)(T socket, size_t receiveCount) > { > ubyte[] buffer = new ubyte[receiveCount]; > size_t count = socket.receive(buffer); Don't trust code you fin

Re: `Socket.receive` providing arbitrary packet sizes and hanging without sending EOF

2017-12-14 Thread Ali Çehreli via Digitalmars-d-learn
On 12/14/2017 11:55 AM, Unazed Spectaculum wrote: This is the only function which has a call to `receiveAll` I marked my changes with [Ali]: import std.stdio; import std.socket; import std.conv; import std.json; ubyte[] receiveBytes(T)(T socket, size_t receiveCount) { ubyte[] buffer = n

Re: `Socket.receive` providing arbitrary packet sizes and hanging without sending EOF

2017-12-16 Thread Unazed Spectaculum via Digitalmars-d-learn
On Thursday, 14 December 2017 at 20:27:36 UTC, Ali Çehreli wrote: On 12/14/2017 11:55 AM, Unazed Spectaculum wrote: This is the only function which has a call to `receiveAll` I marked my changes with [Ali]: import std.stdio; import std.socket; import std.conv; import std.json; ubyte[] rece

Re: `Socket.receive` providing arbitrary packet sizes and hanging without sending EOF

2017-12-16 Thread Ali Çehreli via Digitalmars-d-learn
On 12/16/2017 05:21 PM, Unazed Spectaculum wrote: > 1) Starting program > unazed@unazed  /home/d/storage-server  dmd -debug -run app.d Although I don't normally use the -run switch, as expected, it works with -run as well. (More below.) > Listening: 0.0.0.0:6969 > > 2) telnet to the server