Hey there am assembling a pos terminal that is using tcp/ip for communication.
Has someone got an idea of how i can buffer the received string response from the backend server and use the buffer to print out the request from the terminal?



9 Years
Discussion Span
Last Post by Duoas

You are doing this in assembly?

The answer is "it depends."

It depends on how you have structured your program to work. At the most basic, simply keep a string (a memory buffer) somewhere that stores characters input from the socket. When you are ready to print, just print the buffer and reset it (clear it). If you are handling things in separate threads you'll also have to lock the buffer before printing and clearing.

Hope this helps.


yeah am actually working in assembly and with different threads and may be i will try to lock the socket and open it again for each thread.
thanks for your advice


You don't need to do anything to the socket. (It should only be open in one thread.)

You need to create a mutex on the buffer, so that it is only accessed by one thread at a time.


thanks guys for your advise,i have one more issue please,i realised that the tcp/ip connection looses packets especially if the net or gprs is not stable,how can i change over to http to check on this,thanks


Don't use a DATAGRAM protocol. Just open your socket using SOCK_STREAM or something that guarantees delivery.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.