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 4599210
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T23:30:30+00:00 2026-05-21T23:30:30+00:00

I have a server and a client app, my server listens on port 10015

  • 0

I have a server and a client app, my server listens on port 10015 and a client which sends commands to that port. Currently both are running on the same machine, but in the future the goal will be to have running on different machines. I have this part working right now.

What I need to do next is have my server send commands to my client as well. So I thought I could just re-use my code from my server in my client to listen on a port.

But I am not sure that is the best way to do it. Suggestions?

When I first tried this, I ran my client app first, and it sent the command to itself. My server app failed to bind to the port (I assume you can only have one process listening on a given port? )

Question 1)
How can the server send commands to the client? Do I have to create make the server–>client communication on port 10015 and client—>server on a different port like 10016?

Question 2)
When I send a command from client–>server with send(), what’s the best way to receive an ACK to that specific command? If I dont need to send any data back is there a way to just get an ACK automatically when the packet is received by the server?

I am currently doing this for every command I want to send :

create socket()
conenct() to socket
send() packet
then call recv() to receive any data 
then shutdown() connection
and closesocket() at end

not sure if there’s a better way to do it? I am expecting to send anywhere between 1-10 commands per sec when my app is busy.

thanks, I am new to this networking applications, so any help is greatly appreciated.

Edit after reading some comments:
I am using TCP protocol. When I said ACK, I meant I just wanted some acknowledgement from the other app that the command had been received and processed without errors

  • 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-05-21T23:30:30+00:00Added an answer on May 21, 2026 at 11:30 pm

    Typically the way this is done is as follows:

    1. The “server” binds a socket to a specified port — it looks like that’d be 10015 for you.
    2. The “client” uses an ephemeral port for its outgoing transmissions
    3. If the server is to respond to the client, it sends a message from it’s bound port (10015) to the source port of message #2, the ephemeral port.

    On the server:

    If you are using UDP, you can simply copy the sockaddr structure that was set during recvfrom() into the sockaddr structure that you’re passing to sendto().

    If you are using TCP, the socket file descriptor returned by accept() can be used in send() to send response traffic to the client.

    My favorite C Sockets reference is the free and available online Beej’s Guide to Network Programming.

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

Sidebar

Related Questions

I have a server app that listens for connections on port 8888. I am
We have client server based app which saves user related data into a zip
I have Android client app that communicates with server using Socket . On my
I have a DDE client app which connects to the DDE server app by
I have an application (server side) that sits on a port and listens for
I have client/server application where the client app will open files. Those files get
i have client-server app, I'm managing connections with Threads and handlers inside app, but
I have client-server app. Client on C++, server on Java. I am sending byte-stream
I have a simple client-server app on android. the android service communicates with the
I'm writing chat client/server app with c# and I have problem with threading. I

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.