Logo

Hawk Software

Programming, web design, and more

Recent Posts

Category

Archives

Meta

Ask Phil – Tweaking the TCP time-out

Network, Programming No Comments

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 »

Why I use the GPL/LGPL, but don’t buy into the full GNU philosophy

Programming No Comments

I use the GPL/LGPL (GPL for short) for current projects, and new projects will use the GPL Version 3.  But, I am no big fan of Richard Stallman, so why use the GPL at all, when there are so many other free and open source licenses?  Why do I use a free license at all?  I will answer this second question first since it has a lot to do about how I came to be a programmer. 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 »

Ask Phil – Can an LGPL library be used for commercial software?

Programming No Comments

Many times I have been asked:

I would like to use your library HawkNL (or HawkVoiceDI) in a commercial application.  Does the LGPL allow me to do this? Or can I license your library for a commercial application?

My reply:

First, please read he full terms of the LGPL Version 2.  Basically, if you use the library as a Windows DLL or *nix loadable module or shared object, then you only need to provide source for the library and any modifications you added.  The end user MUST be able to modify the library source and recompile the library if they choose.  A good example of this was Sony’s use of HawkVoiceDI in the game Planetside.  Sony used HawkVoiceDI as a DLL and provided a link to the source code in the online manual.

And yes, these libraries, and some of my other code, is available under a commercial license.  Hawk Software is a part-time job for me, so licensing helps keep this website up!

Real posts 64, spam 1860, and a fixed point conversion update

Programming, Speech/Voice Compression No Comments

Whew!  Just got done reviewing posts to weed out the real ones from the spam.  The amount of spam has greatly increased over the last week, and out of 70 posts since yesterday there was ONE real post.  Or, at least, it was not obviously spam!

I know some are waiting for the rest of the floating point to fixed point series, and I am sorry that it is taking a lot more time than I anticipated.  Read the rest of this entry »