Programming/golang
golang tcp socket timeout 주기(listen, read)
구차니
2024. 4. 8. 15:57
listen에서 accept 되면 write timeout은 조금 도외시 해도 되지 않을까 해서
read에만 timeout 하면 될 것 같아서 검색
conn.SetReadDeadline(time.Now().Add(timeoutDuration)) |
[링크 : https://gist.github.com/hongster/04660a20f2498fb7b680]
d := net.Dialer{Timeout: timeout} conn, err := d.Dial("tcp", addr) if err != nil { // handle error } |
[링크 : https://stackoverflow.com/questions/47117850/how-to-set-timeout-while-doing-a-net-dialtcp-in-golang]