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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:37:54+00:00 2026-06-01T08:37:54+00:00

I am trying to pipe XBoard chess commands over TCP. I understand that nc

  • 0

I am trying to pipe XBoard chess commands over TCP. I understand that nc will close a connection when it sees EOF.

Example 1

$ nc -l 1301 | hd &
[1] 10241
$ echo -en "babab" | nc localhost 1301
00000000  62 61 62 61 62                                    |babab|
00000005
[1]+  Done                    nc -l 1301 | hd
$

That is my problem and I just think I need to find out how to make it so that the nc -l command above don’t terminate. I have read that I could use tail -f, but that doesn’t seem to work unless I use files or FIFO’s. Now here is an explanation of a similar problem (I think) that caused me to search for a solution to this problem:

Example 2

I want to run an XBoard Chess engine in the browser and communicate over WebSockets. I therefore launch XBoard like this:

./websockify 2023 -- xboard -fcp "nc -q -1 -k -l 2023"

It starts up and websockify seems to buffer the initial commands from XBoard. I now connect the browser like this:

ws = new WebSocket("ws://localhost:2023/", "base64");
ws.onclose = function(){console.log("close");};
ws.onmessage = function(evt){console.log(window.atob(evt.data));};
ws.onopen = function(){console.log("open");}

(executed in the console on one line)

It connects and I make the first move in XBoard as white, this is the output in the browser console:

open
xboard
protover 2
[2 second delay]
[other commands]
time 30000
otim 30000
b2b3

Everything is good. Now I make a move as black, from the browser: ws.send(window.btoa("move b7b5\n"));
Works too.

Now, when I go and make the third move of the game in XBoard, it doesn’t work anymore. Immediately after mouseup this console output appears:

  1: 127.0.0.1: Target closed
xboard: Error writing to first chess program: Broken pipe
xboard: Error writing to first chess program: Broken pipe
xboard: Error writing to first chess program: Broken pipe
xboard: Error: first chess program (nc -q -1 -k -l 2023) exited unexpectedly

The GUI shows the same.

So my hypothesis is that an EOF is somehow sent from XBoard to netcat after the first move. This doesn’t really make sense, cause how come didn’t websockify report “target closed” earlier? And what made the first move so different from all the other commands XBoard sent?

  • 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-01T08:37:56+00:00Added an answer on June 1, 2026 at 8:37 am

    Yes! I found a solution.

    I changed the xboard “engine” command to ./runserver.sh and wrote runserver.sh as (execute flag set):

    #!/bin/sh
    nc -q -1 -k -l 2023 | tee /dev/null
    

    Everything works now!

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

Sidebar

Related Questions

I'm trying to create a new yahoo pipe that will only returned a slimmed
I'm trying to understand the usage of pipe. A parent process will pipe and
Trying to make this jQuery filter that uses .find case-insensitive. For example, when the
I am trying to setup a pipe between one process that is launched with
I am trying to parse a file that has each line with pipe delimited
I am trying to read unbufferd data from a pipe in Perl. For example
I'm trying to write a WCF pipe service. One of my service's methods will
While trying to implement the Named pipe (e.g. two independent unrelated processes that are
I'm trying to understand the command pipe(2) , e.g : int pipefd[2]; if (pipe(pipefd)
I'm trying to create arrays from strings that have pipe (|) as delimiters and

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.