net: clean up
parent
6a1b16c72c
commit
fde0e39abf
|
@ -121,8 +121,8 @@ fn listen(addr string, port int) Listener {
|
||||||
server_address.sin_port = C.htons(port)
|
server_address.sin_port = C.htons(port)
|
||||||
// htonl: host to network long: same as htons but to long
|
// htonl: host to network long: same as htons but to long
|
||||||
server_address.sin_addr.s_addr = C.htonl(INADDR_ANY)
|
server_address.sin_addr.s_addr = C.htonl(INADDR_ANY)
|
||||||
// size := sizeof(C.sockaddr_in) // 16
|
size := 16 // sizeof(C.sockaddr_in)
|
||||||
if C.bind(listener, &server_address, 16) < 0 {
|
if C.bind(listener, &server_address, size) < 0 {
|
||||||
println('cant bind')
|
println('cant bind')
|
||||||
return bad_listener
|
return bad_listener
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import net
|
import net
|
||||||
|
|
||||||
fn test_dial() {
|
fn test_dial() {
|
||||||
conn := net.dial('irc.freenode.org', 6667)
|
//conn := net.dial('irc.freenode.org', 6667)
|
||||||
println(conn.sockfd)
|
//println(conn.sockfd)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue