Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7789427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:17:42+00:00 2026-06-01T21:17:42+00:00

I have client server application – client on C++ (running on AIX,using library ),

  • 0

I have client server application – client on C++ (running on AIX,using library ), and server on Java (running on Win and on AIX, using java.net., java.io.).
Structure of application is next
Server

//...
while (true)
         {
            final Socket s = ss.accept();
            pool.execute(new Service(s));
         }
// ..

Service.class get byte from input strean and send bytes to otputstream. And close Socket s

Cleint is

SendMessage(msg)
{ 
// ...
   const int socketFD = OpenSocket();
// send bytes
// receive bytes
    close(socketFD);
}  

Question is next: can I once open socket on client-side,
send message, receive message and after some time send new mesage
and receive new message.
without reopen socket?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T21:17:44+00:00Added an answer on June 1, 2026 at 9:17 pm

    Sure you can. The server, however, should understand that more than one message is expected, and should not kill Service until client closes connection. The problem with your implementation, is that Service is a Runnable and not a Thread. If it would loop on receiving messages, it will keep the thread it is running on. If you use FixedThreadPool, this can make a situation when all the pool threads are exhausted and next Service would wait until one of the previous client disconnects. Using CachedThreadPool avoids this, but as a result, the number of threads used is equal to the number of clients. This is not a problem if you have enough main memory (each thread uses roughly 0.5 Mb). If you want to save memory, you can use asynchronous network libraries like Apache Netty. Java 7 has asynchronous channels implemented.

    https://github.com/rfqu/df4j is a lightweight dataflow library, which includes a wrapper over Java7 async network facilities to make them easier to use.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a client-server application written in Java using CORBA for the communication. The
I have a client server application writter in C# .NET using Sockets. I often
Helloes good people of Stack Overflow, I have a .NET client-server application running with
I have a client server application where I am using java serversocket(server side) and
We have a client/server application with a rich client front end (in .Net) and
I have a client/server application that communicates with .Net remoting. I need my clients
I have a client-server application that uses .net remoting. The clients are in a
I have a client Server application which communicate using objects. when I send only
I have client server cocoa application. client communicate with server by using server's IP
I have a client/server application written in delphiXe2 using Indy TIdTCPServer and TIdTCPClient that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.