Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Socket - send multiple lines
Re: Socket - send multiple lines [message #29801 is a reply to message #29710] Thu, 18 November 2010 10:15 Go to previous messageGo to previous message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Thanks for the quick reply, I left after my last post and just back.

It took a bunch of hours but got it working.

"for(;*q;q++)" is a bit new for me. for(;;) until break I understand. If I debugged some code it would become apparent.

What I did was manually added several lines into char buf including the \n and that worked.

Ln = in.GetLine(); putting that into chbuf for each char dropped the '\n'

cc = Ln.GetCount();
if(j==cc || ch=='\n') ch = '\n';
chBuf[kB] = ch;

'\n' is just int 10, it wasn't necessary to tinker with escape codes.

Also at the end of a set of lines:
chBuf[kB] = 0;
Otherwise if a previous set was longer there is extra char in the buf.

In TheIde in debug the chbuf just shows the first part, select all or copy didn't work for me.

Data2<<= chBuf; into an EditField the select all->copy worked.
The chbuf held up to ~2100 char.
Then I could paste that into Notepad++ and what was received by the Java app it interacts with to compare.
The C++ to Java is why a socket is necessary. Trying shared memory was a real pain that made my head hurt.

Also what someone may find useful:
// LeftPosZ(13, 248).TopPosZ(64, 54); // for deploy
LeftPosZ(13, 248).TopPosZ(66, 100); // for debug
That way there is room for 5 extra data fields for debugging.

The highest I have tested this is 50 lines per chbuf and sent once every second for one of 60 sets, or when replaying one second represents one minute. The chbuf is made 6o times per second with 50 lines each.
CPU usage <2% running by itself.

edit: I did notice it may take longer than a second but that is not important now. At most in real time only one chbuf will be made and sent through the socket per second.
For replay of data these are also useful:
pos = in.GetPos();
in.SeekCur(fwd);

No changes to the socket server or client was necessary.


[Updated on: Thu, 18 November 2010 11:42]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Using U++ without UppIDE
Next Topic: [ASK] IBM DB2 Connector
Goto Forum:
  


Current Time: Sat Jun 07 16:38:33 CEST 2025

Total time taken to generate the page: 0.04997 seconds