Closed tpaivaa closed 11 months ago
The tcp connection may still be kept by OS after being closed locally, see the next link for some more details and option to improve dealing with.
A variant would be not to provide the local address, then a different port should be used every time.
I am closing it, because it is no much that can be done in sipexer. Or if somebody finds options to improve in the Go code, just make a pull request.
When running multiple tcp commands in row. at least in my endeavours, I encounter some problems with hanging tcp connection
sipexer -message -mb 'Heipa hei hoo' -laddr :5060 tcp:10.250.39.62:5060
[info] [sipexer.go:1434] main.SIPExerDialogLoop(): local socket address: 10.250.39.36:5060 (tcp) [info] [sipexer.go:1435] main.SIPExerDialogLoop(): local via address: 10.250.39.36:5060 [info] [sipexer.go:1436] main.SIPExerDialogLoop(): sending to tcp 10.250.39.62:5060: [[--- MESSAGE sip:10.250.39.62:5060;transport=tcp SIP/2.0 Via: SIP/2.0/TCP 10.250.39.36:5060;rport;branch=z9hG4bKSG.de99e435-7200-44bf-b954-4e8a7a8fdc4c From: sip:alice@localhost;tag=a50e604c-99c4-4849-8ab2-538b6e809b9b To: sip:bob@localhost Call-ID: 363536fc-df2a-4c13-99c9-f09407766a8e CSeq: 385409 MESSAGE Date: Thu, 10 Nov 2022 14:01:12 UTC User-Agent: SIPExer v1.0.3 Content-Length: 13 Content-Type: text/plain
Heipa hei hoo [info] [sipexer.go:1438] main.SIPExerDialogLoop(): ---]]
[info] [sipexer.go:1489] main.SIPExerDialogLoop(): response-received: from=10.250.39.62:5060 bytes=304 data=[[--- SIP/2.0 403 Forbidden Via: SIP/2.0/TCP 10.250.39.36:5060;rport;branch=z9hG4bKSG.de99e435-7200-44bf-b954-4e8a7a8fdc4c To: sip:bob@localhost From: sip:alice@localhost;tag=a50e604c-99c4-4849-8ab2-538b6e809b9b CSeq: 385409 MESSAGE Call-ID: 363536fc-df2a-4c13-99c9-f09407766a8e Content-Length: 0
[info] [sipexer.go:1491] main.SIPExerDialogLoop():
---]]
sipexer -message -mb 'Heipa hei hoo\n' -laddr :5060 tcp:10.250.39.62:5060
[error] [sipexer.go:1731] main.SIPExerSendTCP(): error: dial tcp4 :5060->10.250.39.62:5060: bind: address already in use
netstat -an | grep 10.250.39.62 tcp 0 0 10.250.39.36:5060 10.250.39.62:5060 TIME_WAIT
tested with: go version go1.19.3 linux/amd64
on: PRETTY_NAME="Debian GNU/Linux 11 (bullseye)" NAME="Debian GNU/Linux" VERSION_ID="11" VERSION="11 (bullseye)" VERSION_CODENAME=bullseye ID=debian