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 » U++ Library support » U++ MT-multithreading and servers » Problem using TcpSockets
Re: Problem using TcpSockets [message #42016 is a reply to message #42014] Tue, 11 February 2014 09:14 Go to previous messageGo to previous message
koldo is currently offline  koldo
Messages: 3361
Registered: August 2008
Senior Veteran
Hello guys!

Lets put an example:

- In one side there is a client that just does socket "send()" sending strings ended with '\n'.

- In the other side, there is a server based on SocketServer demo.

This is similar to SocketServer, and just shows the first line Sad :
	for(;;) {
		TcpSocket s;
		if(s.Accept(server)) {
			Cout() << "Request from: " << s.GetPeerAddr() << '\n';
			Cout() << "Received: " << s.GetLine() << "\n";
		}
	}

This shows all the lines (although it does not stop the loop Rolling Eyes );
	for(;;) {
		TcpSocket s;
		if(s.Accept(server)) {
			Cout() << "Request from: " << s.GetPeerAddr() << '\n';
			while(true) 
				Cout() << "Received: " << s.GetLine() << "\n";
		}
	}





Best regards
IƱaki
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: GuiMT compilation error on ubuntu12.04
Next Topic: [SOLVED] Unable to compile MT applications (weird assembler error with GCC on Linux i386 arch)
Goto Forum:
  


Current Time: Tue May 14 03:21:56 CEST 2024

Total time taken to generate the page: 0.02585 seconds