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
Socket - send multiple lines [message #29710] Tue, 09 November 2010 23:25 Go to previous message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
I have been using a socket client that works OK but just sends/receives a line at a time.

I would like to send about 50 lines at a time, ~2KB
I suppose this would be the same as sending a text file.
#ifndef _ConnSock_ConnSock_h_
#define _ConnSock_ConnSock_h_

#include <Web/Web.h>

using namespace Upp;

String snd(String r, int a){ 
	Socket s;
	if(!ClientSocket(s, "127.0.0.1", 5024)) {
	    return "x";
	}
	s.Write(r + '\n');
	if(a==1){
    	    String st = s.ReadUntil('\n');
	    return st;
	}
	return "y";
}
#endif

if(a==1) a String will be returned by the server, just a comma delimited line, otherwise no ReadUntil.

On the slowest machine Sleep(5) is required between lines or a printout from the server shows some lines are out of sequence or dropped.

Is there an example in upp that shows how to send several lines??

edit: The server is in Java and has:
inRd = new BufferedReader(new InputStreamReader(client.getInputStream()));

I can parse the buffer into lines there.

Neil

[Updated on: Tue, 09 November 2010 23:52]

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: Thu May 09 00:44:51 CEST 2024

Total time taken to generate the page: 0.03650 seconds