Posts

Ephermal ports

TCP Ports in the range 1024 to 5000 are used when a connection is made outbound from a machine. There are approximately 4000 of them. After the connection is torn down, the port is unavailable for a period of time greater than the max Time To Live (TTL) for IP packets on the network. The easiest way to check is to run “netstat /a /n” on the server. If all the ports in this range are in CLOSE_WAIT state, then the server can not make our bound calls (for instance to the DC to authenticate). MSDN has articles describing how to raise this limit. http://support.microsoft.com/default.aspx?scid=kb;en-us;812873

multi threaded programming

Every one says multi thread programming is hard. Here is a way I think to reduce the problem.   Understand what is the critical data you are trying to protect. Do you understand what happens if you just let different threads party on your data. If you do not understand this don’t go further.Understanding of this crucial in designing what kind of protection mechanisms you need. After doing analysis in above two steps its pretty clear what you need to protect. Single variable protection : An example of this is a state variable that can be set by multiple threads but you have a state machine to follow.This requires protection on this single variable to make we only do the valid transitions. Look at Interlocked* functions for this. Complex data structure : For ex a list that needs to be read and modified. For this you want to look at critical section that protects the data structure against multiple threads. More complex synchronization mechanisms include cross process coord...