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 » Developing U++ » U++ Developers corner » SCGI Class
Re: SCGI Class [message #31779 is a reply to message #31778] Sun, 27 March 2011 06:54 Go to previous messageGo to previous message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Mindtraveller wrote on Sat, 26 March 2011 23:00

What if in the main cycle the the newly created client socket is processed in another thread while server socket is free to accept more connections?
while (run)
{ if  (serverSocket.Accept(&clientSocket)
  {
    GetThreadFromPoolAndProcess(clientSocket);
  }
}



That seems like the logical way.
My Upp apps as clients interact with Java apps/server.
New thread/socket for each client.

	// The body of the server thread. Loop forever, listening for and
	// accepting connections from clients. For each connection,
	// create a Connection object to handle communication through the
	// new Socket.
	public void run() {
		try {
			while (true) {
				Socket client_socket = listen_socket.accept();
				Connection c = new Connection(client_socket);
			}
		} catch (IOException e) {
			fail(e, "Exception while listening for connections");
		}
	}
}


I did not write the server code but just followed an example.

Neil

[Updated on: Sun, 27 March 2011 07:15]

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
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How should we deal with SQL column names in conflict with SQL standard keywords
Next Topic: What's up with Google subversion mirror?
Goto Forum:
  


Current Time: Sat May 11 18:06:58 CEST 2024

Total time taken to generate the page: 0.02526 seconds