udp

golang udp connection refused on every other write

家住魔仙堡 提交于 2020-12-07 05:14:18
问题 I ran this UDP client program on ubuntu linux 16.04: package main import ( "fmt" "net" "time" "strconv" ) func CheckError(err error) { if err != nil { fmt.Println("Error: " , err) } } func main() { ServerAddr,err := net.ResolveUDPAddr("udp","127.0.0.1:10001") CheckError(err) LocalAddr, err := net.ResolveUDPAddr("udp", "127.0.0.1:0") CheckError(err) Conn, err := net.DialUDP("udp", LocalAddr, ServerAddr) CheckError(err) defer Conn.Close() i := 0 for { msg := strconv.Itoa(i) i++ buf := []byte

golang udp connection refused on every other write

旧巷老猫 提交于 2020-12-07 05:12:36
问题 I ran this UDP client program on ubuntu linux 16.04: package main import ( "fmt" "net" "time" "strconv" ) func CheckError(err error) { if err != nil { fmt.Println("Error: " , err) } } func main() { ServerAddr,err := net.ResolveUDPAddr("udp","127.0.0.1:10001") CheckError(err) LocalAddr, err := net.ResolveUDPAddr("udp", "127.0.0.1:0") CheckError(err) Conn, err := net.DialUDP("udp", LocalAddr, ServerAddr) CheckError(err) defer Conn.Close() i := 0 for { msg := strconv.Itoa(i) i++ buf := []byte

golang udp connection refused on every other write

吃可爱长大的小学妹 提交于 2020-12-07 05:12:19
问题 I ran this UDP client program on ubuntu linux 16.04: package main import ( "fmt" "net" "time" "strconv" ) func CheckError(err error) { if err != nil { fmt.Println("Error: " , err) } } func main() { ServerAddr,err := net.ResolveUDPAddr("udp","127.0.0.1:10001") CheckError(err) LocalAddr, err := net.ResolveUDPAddr("udp", "127.0.0.1:0") CheckError(err) Conn, err := net.DialUDP("udp", LocalAddr, ServerAddr) CheckError(err) defer Conn.Close() i := 0 for { msg := strconv.Itoa(i) i++ buf := []byte

Send UDP from specific port without bind

廉价感情. 提交于 2020-12-04 03:41:14
问题 The problem is that there are two processes: Process A knows only to send. Process B knows only to receive. And process C is a compiled binary so it cannot be changed. Process C has to receive from A and send to B. I bind process B to port X. Since process A always sends each time from different random port and process C answers it to these ports, process B never get data. Currently my solution: Bind process B to listen on port X (using reuse) Bind process A to send from port X (using reuse)

Send UDP from specific port without bind

血红的双手。 提交于 2020-12-04 03:40:50
问题 The problem is that there are two processes: Process A knows only to send. Process B knows only to receive. And process C is a compiled binary so it cannot be changed. Process C has to receive from A and send to B. I bind process B to port X. Since process A always sends each time from different random port and process C answers it to these ports, process B never get data. Currently my solution: Bind process B to listen on port X (using reuse) Bind process A to send from port X (using reuse)

Send UDP from specific port without bind

前提是你 提交于 2020-12-04 03:40:36
问题 The problem is that there are two processes: Process A knows only to send. Process B knows only to receive. And process C is a compiled binary so it cannot be changed. Process C has to receive from A and send to B. I bind process B to port X. Since process A always sends each time from different random port and process C answers it to these ports, process B never get data. Currently my solution: Bind process B to listen on port X (using reuse) Bind process A to send from port X (using reuse)

How to set source address when sending using and UDP socket

允我心安 提交于 2020-11-28 08:13:53
问题 I've two pc using VRRP for redundancy. So every PC (Linux) has a physical and a Virtual IP address. I've a software (C++) with a client/server architecture with UDP protocol. The software bind the listen socket on "0.0.0.0" and use a new socket every time it needs to send some data to the other party. With wireshark I saw that when it sends data the source IP is the phisycal one... How can I set the source address of the sending socket to the Virtual one?? NOTE: Whit ifconfig I see only eth0

How to set source address when sending using and UDP socket

瘦欲@ 提交于 2020-11-28 08:08:14
问题 I've two pc using VRRP for redundancy. So every PC (Linux) has a physical and a Virtual IP address. I've a software (C++) with a client/server architecture with UDP protocol. The software bind the listen socket on "0.0.0.0" and use a new socket every time it needs to send some data to the other party. With wireshark I saw that when it sends data the source IP is the phisycal one... How can I set the source address of the sending socket to the Virtual one?? NOTE: Whit ifconfig I see only eth0