I am using a SCTP client to send 1000byte data to another SCTP server over a 100m sec delay link. The delay is configured using traffic control(tc) and netem available in Linux
tc qdisc add dev eth0 root netem delay 100ms
The code I have used is from SCTP Multihoming. I have set roundtrip time(max) to 60 seconds and heartbeat to 10sec. Now the issue I am facing is that I can send around 3 to 4 packets of 1000 bytes properly. After that the "Connection reset by peer" happens and because of that I am not able to send any more packets. Can you please let me know what I need to do to send SCTP data over high latency link. Thanks for your help.
Finally I could fix the issue. The issue is caused by a NAT box in between the SCTP client and server. The NAT changes the ip address and during the SCTP heart beat message exchange, since the ip address is different, the client cant find the right ip address and because of this SCTP association fails. So SCTP server sends an ABORT to the client. I removed the NAT and everything went fine.
Related
Golang application with a client and server.
Server uses net.ListenUDP -- client also uses net.ListenUDP, connects to server and sends a packet with conn.WriteToUDP with the server address.
Server receives the packet with ReadFromUDP and grabs the return address. Using this return address, it then sends a large number of packets back to the client.
When running both client and server on local machine, this works perfectly. Using Wireshark I can inspect the UDP packets and see that they contain the source and destination ports - and in the application I can see that they arrive and my various checksum tests show the data is accurate.
I then moved the server off site to a remote machine. The application stops working. I can successfully send the first message from the client to server - this is received just fine. The server sends the response back 'toward' the client - but the client never receives them.
Using Wireshark, I can see that the packets do arrive back on the local machine with the correct IP address. It appears that my network router has performed NAT on the outgoing packets - and has correctly re-addressed response packets to the internal IP.. BUT there is no port.
So I have UDP packets arriving on the correct machine, but no port - so the client application does not receive them. Application times out on ReadFromUDP.
I don't know if it is relevant, but on local machine, Wireshark labels the packets as BT-uTP Utorrent packets. When they come in from remote server, this is what I see in Wireshark - note the lack of Port.
Any thoughts how I can solve this. I didn't think this was a UDP hole punching problem because although I am establishing a connection across a NAT it is with a server not a peer.
This packet is fragmented, You can see this under Internet Protocol Version 4 > Flags.
If you look at the frame as shown on the bottom of the picture you provided you should see the ports.
net.ListenUDP doesn't appear to support fragmentation at the socket level.
Do you have a PPPoe connection? You may need to reduce your packet size being sent by 8 bytes or change the MTU on the routers external interface of the remote side. You may also need to change the local routers MTU if it's on a PPPoe interface.
I have around 43 Embedded devices(2.4GHz band) connected to home router(Netgear N300). What I have found is that my Netgear router does not allow more than 32 DHCP clients to connect. Hence I put a repeater(Dlink DIR 816, dual antenna, DHCP server disabled) just to extend the router client table capacity. This was successfully accomplished as all my 43 embedded devices and 3 computers remain connected to the main router. The devices connect to a TCP server hosted on a computer which is assigned a static IP in router table. I avoid half broken pipe in TCP by sending "ALIVE" packets from server to my devices every 1 second. If the device fails to receive this packet in a 5 second window, it breaks the connection and reconnects. This setup has worked for a few months, but now I have encountered a weird problem. After a few hours of operation, my devices stop receiving these "ALIVE" packets and continuously make and break connections. Once I restart my computer everything becomes normal for next few hours. I am unable to identify what the issue might be.
Following points I have deduced:
1. It is not computer problem as I have changed the computer hosting TCP server but the issue remains
2. It is not router problem as even when I restart the router the issue does not go away
3. It is not TCP server problem as even if I restart my TCP server the connect-disconnect cycle continues
Can anybody help me about what might be causing this problem?
(All the communications with my device are limited to a few bytes)
So you're sending 43 alive packets over TCP via Wi-Fi per second using a $40 router. TCP transmission implies unicast delivery with acknowledgements - over wifi, 43 times per second. It makes me think the Wi-Fi access point hardware is the weakest point here (let alone that 43 devices is just too much for a home grade router).
To check the connection over Wi-Fi, make your embedded devices ping your server over ICMP. The devices may not have ping application available, but it's pretty straingforwand to implement by yourself.
If the AP is broken, you'll probably see a wide range of response times: from 100 ms to 3 seconds.
If this theory proves true, you may also want to revise your system's architecture. TCP is a heavy thing. It doesn't support multicast whereas UDP, IP and WiFi do (though I'm not sure about the last). Single multicasted alive message to all clients instead of 43 TCP transmissions should greatly reduce the load on your network.
Can it be done in XE7+ to Broadcast the UDP packets to specific machines/IPs?
For example, I have 10 machine in LAN. Server Broadcasted to all 10 machines. Two machines accepted the packets (clients) and Server then tool its details and keep it in DB. Now these machines are down and up again. Server again Broadcasted the UDP packets but this time to only 8 machines/IPs; and two active machines who were already hand-shaked are not sent these packets. In this process we keep on adding the machine/IPs in our DB till the time all the machines/IPs are added. Once all are added then no UDP packets is sent by the Server. It would become responsibility of the machine to send data packets once it is up.
Update:
I need only suggestion and guidance. Rest would be taken care by me like coding, threading etc.
By definition, a UDP broadcast cannot target a specific peer IP, only a network subnet. If you target a specific IP, it is not a broadcast anymore, you are just doing direct peer-to-peer communication normally.
For what you are attempting, you will have to broadcast across the subnet each time so you can discover new machines, and just ignore responses from any machines you already know about.
I'm finding out the proper MTU (Maximum Transfer Unit) size of a mail server using this guide. However, the server blocks pings. Is there any other ways I can determine the MTU size without admin access to the mail server?
You are trying to do path MTU discovery.
As long as no firewalls on the way block all ICMP traffic (because returning "Fragmentation needed" ICMP packeges have to reach you), the method provided will work with IP packages of all kind. You would just have to send IP packages with the 'DF' flag set and watch for returning "Fragmentation needed" ICMP packages.
Here is a example in python using raw sockets.
I am using jain-sip stack on centos 64bit machine, and below is the detail steps and explanation of the issue
Register to SIP Server using jain-sip client
Register timeouts for every 360 seconds
During Reregistration process if server is down due to network issue, the outbound TCP socket is
continue to retransmit the registration request, it takes around 15 minutes to close this socket
So client is unable to register for 15 minutes even after loosing network connectivity for few seconds
This works fine with the same code on windows, in windows there will be 5 retransmission then socket gets closed, when client re tries new socket will be opened.
Please help to resolve this issue on centos
If the socket is in frozen state then the OS should take care of the recovery. Monitor with tcpdump what happens with TCP retransmissions. If you want to force JSIP to close the socket, use ((SIPTransactionStack)sipStack).closeAllSockets(); and then implement your recovery logic in the app.