read does not seem to block
dowling-john opened this issue · 1 comments
dowling-john commented
Hey Guys,
This could be a really noob issue but cannot seem to find an answer.
so I seem to be getting an issue with the read method in that it will just return a nil value unless there is data ready to read, currently I am using a small wait to slow it down a little and allow the network to catchup, but as you can imagine this is a little hit and miss.
Does anyone know how to get this to block till either the timeout or the buffer size ?
below is an example of the code i'm using.
switch client.send(data: data) {
case .success:
usleep(20000)
data = client.read(1024*10)!
print(data)
case .failure(let err):
print(err)
client.close()
}
dowling-john commented
Closing this as duplicate of #122