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)
|
||||
// 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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue