mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
net: make socket.recv return the allocated buffer and the message length
This commit is contained in:

committed by
Alexander Medvednikov

parent
bf1ee28194
commit
0e39df24d4
@@ -17,9 +17,13 @@ fn test_socket() {
|
||||
|
||||
message := 'Hello World'
|
||||
socket.send(message.str, message.len)
|
||||
$if debug { println('message send: $message') }
|
||||
$if debug { println('send socket: $socket.sockfd') }
|
||||
|
||||
bytes := client.recv(1024)
|
||||
received := tos(bytes, message.len)
|
||||
bytes, blen := client.recv(1024)
|
||||
received := tos(bytes, blen)
|
||||
$if debug { println('message received: $received') }
|
||||
$if debug { println('client: $client.sockfd') }
|
||||
|
||||
assert message == received
|
||||
|
||||
|
Reference in New Issue
Block a user