go - Can you target a specific port using icmp? -
i believe title pretty self explanatory, in case, i'll explain further.
i writing function in go uses icmp check if particular service running. got idea ping implemented in go. when try command line ping, can not resolve 127.0.0.1:8080
, , function follows suit, makes sense. can use icmp check address , port missing? or should stick tcp target port?
right have simple function, , could use tcp, i'm curious if use icmp.
func (c *controller) ping() error { conn, connerr := net.dial("ip4:icmp", c.apiserverip) if connerr != nil { return connerr } conn.setdeadline(time.now().add(3 * time.second)) defer conn.close() return nil }
no. there no ports in icmp.
if want know whether specific tcp server running, try connect it.
Comments
Post a Comment