User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Assembly section within the Software Development category of DaniWeb, a massive community of 455,975 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,758 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Assembly advertiser: Programming Forums
Views: 899 | Replies: 5
Reply
Join Date: Nov 2007
Posts: 3
Reputation: sammmy is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sammmy sammmy is offline Offline
Newbie Poster

Help printing buffer strings

  #1  
Nov 29th, 2007
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?



Regards

Sam
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation: Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold 
Rep Power: 13
Solved Threads: 193
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: printing buffer strings

  #2  
Nov 29th, 2007
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.
Reply With Quote  
Join Date: Nov 2007
Posts: 3
Reputation: sammmy is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sammmy sammmy is offline Offline
Newbie Poster

Re: printing buffer strings

  #3  
Nov 30th, 2007
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
Reply With Quote  
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation: Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold 
Rep Power: 13
Solved Threads: 193
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: printing buffer strings

  #4  
Nov 30th, 2007
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.
Reply With Quote  
Join Date: Nov 2007
Posts: 3
Reputation: sammmy is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sammmy sammmy is offline Offline
Newbie Poster

Re: printing buffer strings

  #5  
Dec 14th, 2007
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
Reply With Quote  
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation: Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold 
Rep Power: 13
Solved Threads: 193
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: printing buffer strings

  #6  
Dec 14th, 2007
Don't use a DATAGRAM protocol. Just open your socket using SOCK_STREAM or something that guarantees delivery.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Assembly Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Assembly Forum

All times are GMT -4. The time now is 9:19 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC