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

  • Home
  • SEARCH
  • 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 6390523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:33:27+00:00 2026-05-25T03:33:27+00:00

I need to write a sort of proxy server and my design is a

  • 0

I need to write a sort of proxy server and my design is a little like this:
1. Socket server (using Windows Event select model). program has a listener thread listenimng for network events.
2. list of clients (currently indexed by socketid).
3. socket server accepts a new connection and then creates a new thread for each client. The new thread creates a socket connection to end destination server (want a persistent connection).

I have already written the socket server and that works fine. My problem is as new messages come in from clients, how do I pass this message onto the relevant thread (so message can be sent onto to destination server).

In my server I get the address of the final destination server from the client message. I can lookup the client socket from the list of client sockets. But how do I then send the message to the correct thread?

In the threading I have worked with so far, the thread function just runs a loop. Do I call the thread function, passing it the message as a parameter?

Anyone got any good ideas on how to do this?

Could I not just have a map of client socket id and destination server socket id.

After accept on a client socket, connect to destination server and send msg. Save destination server socket id to the map.

Thenceforth, when get a new msg from client, lookup dest server in map and send message to requisite server socket.

Actually, do I need to make this multi-threaded?

  • 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-25T03:33:28+00:00Added an answer on May 25, 2026 at 3:33 am

    Use a messaging or synchronization primitive, such as a queue, mailbox, event signal, etc.

    For instance, if each thread has a queue for data to send, you would simply write to this queue. The queue must be thread safe to allow concurrent access.

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

Sidebar

Related Questions

I need to write a web application using SQL Server 2005, asp.net, and ado.net.
I need to write a java script. This is supposed to validate if the
I need write an update statement that used multiple tables to determine which rows
I need to write a program used internally where different users will have different
I need to write a Java Comparator class that compares Strings, however with one
I need to write a Delphi application that pulls entries up from various tables
I need to write code that picks up PGP-encrypted files from an FTP location
I need to write an extension method on a byte[]. Is that possible?
I need to write test cases for my application. I've chosen NUnit. Please let
I need to write a rule to redirect any image file to a specific

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.