net: clean up

pull/1049/head
Alexander Medvednikov 2019-06-30 21:00:22 +02:00
parent 6a1b16c72c
commit fde0e39abf
2 changed files with 32 additions and 32 deletions

View File

@ -121,8 +121,8 @@ fn listen(addr string, port int) Listener {
server_address.sin_port = C.htons(port)
// htonl: host to network long: same as htons but to long
server_address.sin_addr.s_addr = C.htonl(INADDR_ANY)
// size := sizeof(C.sockaddr_in) // 16
if C.bind(listener, &server_address, 16) < 0 {
size := 16 // sizeof(C.sockaddr_in)
if C.bind(listener, &server_address, size) < 0 {
println('cant bind')
return bad_listener
}

View File

@ -1,6 +1,6 @@
import net
fn test_dial() {
conn := net.dial('irc.freenode.org', 6667)
println(conn.sockfd)
//conn := net.dial('irc.freenode.org', 6667)
//println(conn.sockfd)
}