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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:32:51+00:00 2026-05-31T00:32:51+00:00

I am trying to understand tcp connections between a browser and a web server.

  • 0

I am trying to understand tcp connections between a browser and a web server. I have a web server running on my local machine, and can browse to it just fine, as expected, using localhost:3000 or 127.0.0.1:3000. (I am running “rails s”and WEBrick.)

I wanted to put a software intermediary between the browser and the web server, and so began experimenting with socat. The following works just fine:

socat TCP-LISTEN:8080,fork TCP:localhost:3000

I can browse to localhost:8080 and things work as expected. However, if I omit the “,fork” argument like so,

socat TCP-LISTEN:8080 TCP:localhost:3000

the local rails web site is quite broken looking in the browser.

Why is that fork argument necessary? Why wouldn’t a browser <–> web server connection work without it?

  • 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-31T00:32:53+00:00Added an answer on May 31, 2026 at 12:32 am

    Without the fork, socat will accept a single TCP connection, forward data bidirectionally between the two endpoints for as long as that connection remains open, then exit. You can see this yourself easily:

    • Run socat in one terminal window
    • Telnet to localhost 8080 in another terminal window. It connects to the socat instance.
    • Telnet to localhost 8080 in a third terminal window. You get a connection refused error, because socat is not listening for new connections anymore: it has moved on to servicing the one it already got.
    • Type an HTTP request into the second terminal window. You’ll get an HTTP response, and then socat will exit as the connection is closed.

    The fork option just makes it fork a new child to process the newly accepted connection while the parent goes back to waiting for new connections.

    socat‘s use of fork() rather than something more sophisticated like preforking or connection pooling is the reason you wouldn’t want to implement high-performance middleware with socat!

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

Sidebar

Related Questions

Just trying to understand that - I have never used it before. How is
I am trying to understand the relation between TCP/IP and HTTP timeout values. Are
I have implemented TCP/IP communication between a VB and VC++ programs running on the
I'm trying to understand the difference between a TCP segment with the flag PSH
Trying to understand something. I created a d:\svn\repository on my server. I committed folders
I am trying to understand the purpose of addListener in node.js . Can someone
I'm trying to build a simple multithreaded tcp server. The client connects and sends
I’m trying to write a custom TCP based long polling server that will serve
trying to understand how custom admin commands work, I have my project named mailing
i'm trying understand what are consequences of enabling compression for web service response. Web

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.