× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



There is no such thing as a "fixed length" record in TCP. Just a guess but since you are not accounting for variable length data transmission size every receive your program will only work by chance. You have to check the length of the received data every read, then only read the amount (remainder) you need in each subsequent read. For example, if the total sender size is 4096 bytes per "record"(your terminology) and you read using a buffer and request size of 4096 bytes, that doesn't mean you will "get" 4096 bytes. Therefore, you have to check the total bytes sent, and keep reading until the total is equivalent to the amount you want being careful to only read the amount of bytes in remainder. If you request more than the amount available from the sender the program will hang on the socket until more data is available or time-out is received. Most good socket programs have a set of commands embedded in the socket stream which indicate states such as begin, end, length of transmission, etc.
I don't know about the tutorial you mentioned but there is a whole encyclopedia of network programming information. In order to trust your program to handle the variety of conditions when not controlling the whole process you will have to spend a good amount of time studying and practicing socket programming. If you want to learn socket programming then get a good book, learn C or Java and then just do it. If you do not have the time and it's an important product to your company then I suggest purchasing a vendors TCP toolkit or using Java libraries of which there are plenty. That way you can safely ignore all the networking details.
_________________________________________________________________
Climb to the top of the charts! Play the word scramble challenge with star power.
http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_jan

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.