Hawk Logo

Hawk Software

Programming, web design, and more

Recent Posts

Category

Archives

Meta

Ask Phil – Tweaking the TCP time-out

Network, Programming Comments Off

Kama asked:

I have a question related to the tweaking of TCP timeouts and retries. Basically I have an application that connects to a remote server to perform various operations. If the server dies however, it will perform operations on a local database then sync up with the server later. In linux, if the remote server is offline, the application tries to reach the server for approximately 2 minutes before it gives up and uses the local database. This of course makes the application seem like it has hung.

I’ve done some research into tweaking tcp settings. I’ve found various settings that I can tweak in the proc systems using sysctl. I’m not sure which ones will work for this task. I’m currently playing with:

tcp_orphan_retries
tcp_retries1
tcp_retries2

Does anyone know if I’m on the right track? Also I know these flags alter the settings based on the retransmission timeout (RTO). Is there anyway of tweaking the RTO? Or will tweaking one of the above flags suffice?

My reply: Read the rest of this entry »

Ask Phil – Losing UDP packets

Network, Programming 2 Comments

Maxime once asked:

My C program needs to send UDP packets in burst. I have the following code:

send_data()
{
err = sendto(sock, &msg1, len1, &add, lenadd);
err = sendto(sock, &msg2, len2, &add, lenadd);
err = sendto(sock, &msg3, len3, &add, lenadd);
err = sendto(sock, &msg4, len4, &add, lenadd);
err = sendto(sock, &msg5, len5, &add, lenadd);
}

I do not get any error.

When I look on the network with a sniffer, sometimes, I [see] packets. but the missing packets are never put on the network.

How can I lose packets if I have a private network with only two nodes?

I use setsockopt(sock,SOL_SOCKET, SO_SNDBUF, &maxsize, sizeof(int)); function to be sure I have enough buffer memory, but that not seams to help.

I have the same result with Windows or Linux.

Does someone have an idea? Read the rest of this entry »

What I’m Reading

Network, Programming, Speech/Voice Compression Comments Off

OK, so I needed a filler while I finalize changes to the next installment to the floating-to-fixed point series ;)   But hey, this is all good, if not varied, information.

Ask Phil – Where are unicode Winsock functions?

Network, Programming Comments Off

Many people have asked questions similar to this:

When I get into winsock in globalization, I found out winsock.h has a lot of different data structure if _UNICODE turned on. But, there is no function support those data types. such as gethostbyname(…) only take const char FAR * name. How could I call gethostbyname when _UNICODE turned on in Visual C++?

My reply: Read the rest of this entry »

Ask Phil – UDP datagram loss

Network, Programming Comments Off

Mike asked:

I have a question about the loss of UDP datagrams.  System setup like below:

 /-------------\    Crossover    /-------------\
 | System A    |  <------------> | System B    |
 | 192.168.0.1 |      Cable      | 192.168.0.2 |
 \-------------/      100MB/s    \-------------/

If I have a test program to send UPD datagrams across this connection, assuming I am not overloading the link, should I expect any datagram loss? Read the rest of this entry »