# \#sockets

**URL:** https://discourse.julialang.org/tag/sockets/391.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Close instead of wait if TCP socket is never drained](https://discourse.julialang.org/t/close-instead-of-wait-if-tcp-socket-is-never-drained/131727)

<div class="topic-metadata">

**Author:** [@ettersi](https://discourse.julialang.org/u/ettersi)\
**Replies:** 1\
**Last updated:** [August 24, 2025, 3:23pm UTC](https://discourse.julialang.org/t/close-instead-of-wait-if-tcp-socket-is-never-drained/131727 "2025-08-24T15:23:50Z")

</div>

I was wondering how the triplet of OS, libuv and Julia handles the scenario where a TCP socket is constantly written to but never read from on the peer’s side, so I came up with this little test script. s = listen(1234)…

---

## [Equivelent HTTP.jl code for Python socket implementation](https://discourse.julialang.org/t/equivelent-http-jl-code-for-python-socket-implementation/129566)

<div class="topic-metadata">

**Author:** [@AwesomeQuest](https://discourse.julialang.org/u/AwesomeQuest)\
**Replies:** 1\
**Last updated:** [June 3, 2025, 9:50am UTC](https://discourse.julialang.org/t/equivelent-http-jl-code-for-python-socket-implementation/129566 "2025-06-03T09:50:13Z")

</div>

I’m trying to emulate a piece of Python code that talks to a http server in Julia but I don’t really understand the python code or how to translate it into equivalent HTTP.jl and Sockets.jl code. Here’s a very compresse…

---

## [Can't reopen socket (EADDRINUSE)](https://discourse.julialang.org/t/cant-reopen-socket-eaddrinuse/129345)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 1\
**Last updated:** [May 26, 2025, 2:06pm UTC](https://discourse.julialang.org/t/cant-reopen-socket-eaddrinuse/129345 "2025-05-26T14:06:34Z")

</div>

I’m writing a script where I open some TCP sockets to communicate with an external process. Once that process is finished I close the sockets and then I want to do the same thing again. When I try to open the sockets the…

---

## [\`setsockopt\` not defined](https://discourse.julialang.org/t/setsockopt-not-defined/126704)

<div class="topic-metadata">

**Author:** [@Stephen](https://discourse.julialang.org/u/Stephen)\
**Replies:** 1\
**Last updated:** [March 8, 2025, 7:30am UTC](https://discourse.julialang.org/t/setsockopt-not-defined/126704 "2025-03-08T07:30:17Z")

</div>

Hello, I want to build the julia version of Futu API referring to this python version, and asked the Grok, ChatGPT, etc and got the function below: sock = Sockets.TCPSocket() # Set receive buffer setsoc…

---

## [Async UDP socket usage](https://discourse.julialang.org/t/async-udp-socket-usage/124401)

<div class="topic-metadata">

**Author:** [@mchitre](https://discourse.julialang.org/u/mchitre)\
**Replies:** 8\
**Last updated:** [January 9, 2025, 7:55am UTC](https://discourse.julialang.org/t/async-udp-socket-usage/124401 "2025-01-09T07:55:22Z")

</div>

We have a problem with async usage of UDP sockets, so I made a MWE to demonstrate it. We run a simple UDP echo deamon with socat: socat -v PIPE udp-recvfrom:9809,fork This listens on port 9809 and echoes back to the s…

---

## [UDPSocket sends short datagram using reinterpret](https://discourse.julialang.org/t/udpsocket-sends-short-datagram-using-reinterpret/122640)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 1\
**Last updated:** [November 14, 2024, 4:33pm UTC](https://discourse.julialang.org/t/udpsocket-sends-short-datagram-using-reinterpret/122640 "2024-11-14T16:33:55Z")

</div>

Is this a bug? Common use case for UDPSocket: I have a struct that isbits. I want to msg = reinterpret(UInt8, \[myobj\]) and transmit this via a UDP datagram to be read on another Julia process, where I’ll just recv the d…

---

## [UPDsocket recv without allocations?](https://discourse.julialang.org/t/updsocket-recv-without-allocations/93481)

<div class="topic-metadata">

**Author:** [@nhardy](https://discourse.julialang.org/u/nhardy)\
**Replies:** 3\
**Last updated:** [May 1, 2024, 8:32am UTC](https://discourse.julialang.org/t/updsocket-recv-without-allocations/93481 "2024-05-01T08:32:20Z")

</div>

I have an application where i am receiving / synthesizing data from a number of sources. One source is UDP packets. From what I can find, the only way to receive data from a sock = UDPSocket() is with recv(sock)… which r…

---

## [\`eval\` scope problem and \`println\` problem for multithreading](https://discourse.julialang.org/t/eval-scope-problem-and-println-problem-for-multithreading/109333)

<div class="topic-metadata">

**Author:** [@ccestbon](https://discourse.julialang.org/u/ccestbon)\
**Replies:** 13\
**Last updated:** [January 28, 2024, 9:17am UTC](https://discourse.julialang.org/t/eval-scope-problem-and-println-problem-for-multithreading/109333 "2024-01-28T09:17:55Z")

</div>

Update 1: Thanks for all the suggesions. I have modifed the code as follows: using Sockets # server server = listen(2000) errormonitor( @async begin sock = accept(server) ex = quote my() = println("aa") end …

---

## [WebSockets vs Oxygen.jl](https://discourse.julialang.org/t/websockets-vs-oxygen-jl/109146)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 4\
**Last updated:** [January 24, 2024, 8:53am UTC](https://discourse.julialang.org/t/websockets-vs-oxygen-jl/109146 "2024-01-24T08:53:13Z")

</div>

I’m sure I’m doing something silly and wrong, I’m just not sure what. In the following two MWE, a server is sending a 1 MB payload a hundrad times to one client, all within the same Julia session (v1.10.0 single thread)…

---

## [Julia can be better at doing web: A benchmark](https://discourse.julialang.org/t/julia-can-be-better-at-doing-web-a-benchmark/103300)

<div class="topic-metadata">

**Author:** [@pankgeorg](https://discourse.julialang.org/u/pankgeorg)\
**Replies:** 27\
**Last updated:** [October 27, 2023, 2:23pm UTC](https://discourse.julialang.org/t/julia-can-be-better-at-doing-web-a-benchmark/103300 "2023-10-27T14:23:35Z")

</div>

Disclaimer: that is, iff I haven’t written anything bad while authoring the benchmark below, (which is likely because I’m not sure what this means Server · HTTP.jl, and whether it’s “recommended” to do this another way).…

---

## [Correct way to perform direct socket io, i.e no memory copy](https://discourse.julialang.org/t/correct-way-to-perform-direct-socket-io-i-e-no-memory-copy/104758)

<div class="topic-metadata">

**Author:** [@L\_Adam](https://discourse.julialang.org/u/L_Adam)\
**Replies:** 1\
**Last updated:** [October 10, 2023, 7:26pm UTC](https://discourse.julialang.org/t/correct-way-to-perform-direct-socket-io-i-e-no-memory-copy/104758 "2023-10-10T19:26:43Z")

</div>

currently, socket read/write are through stream interface, and it’s buffered. and to read that, there is an extra memory copy with take!. what is the proper way to do direct socket io, without memory copy?(or is direct …

---

## [Problem with simple "echo" client/server](https://discourse.julialang.org/t/problem-with-simple-echo-client-server/100009)

<div class="topic-metadata">

**Author:** [@frylock](https://discourse.julialang.org/u/frylock)\
**Replies:** 2\
**Last updated:** [June 7, 2023, 3:18pm UTC](https://discourse.julialang.org/t/problem-with-simple-echo-client-server/100009 "2023-06-07T15:18:11Z")

</div>

Ok - this is not multithreaded or anything, just a simple “echo” server and client (just baby steps - trying to understand simple before I move on from there). I start the server first, then the client in a different she…

---

## [Trouble Sending HTTP Requests to Port 443 (HTTPS) using Sockets.jl](https://discourse.julialang.org/t/trouble-sending-http-requests-to-port-443-https-using-sockets-jl/97998)

<div class="topic-metadata">

**Author:** [@TheDude](https://discourse.julialang.org/u/TheDude)\
**Replies:** 6\
**Last updated:** [April 27, 2023, 8:19pm UTC](https://discourse.julialang.org/t/trouble-sending-http-requests-to-port-443-https-using-sockets-jl/97998 "2023-04-27T20:19:51Z")

</div>

Trying to send HTTP requests using the Sockets.jl package. It works on port 80 say for “example.com” but any attempt to contact a server at port 443 (HTTPS) I’m met with a - 400 Bad Request - The plain HTTP request was…

---

## [Advice needed on multithreaded processing for live data from a UDP socket](https://discourse.julialang.org/t/advice-needed-on-multithreaded-processing-for-live-data-from-a-udp-socket/91948)

<div class="topic-metadata">

**Author:** [@tt1234567](https://discourse.julialang.org/u/tt1234567)\
**Replies:** 2\
**Last updated:** [January 13, 2023, 3:10pm UTC](https://discourse.julialang.org/t/advice-needed-on-multithreaded-processing-for-live-data-from-a-udp-socket/91948 "2023-01-13T15:10:11Z")

</div>

I have an application which receives data from a sensor via UDP, does some processing and displays the results. The data is read in a separate thread and buffered using a Channel. It’s important that the receiver thread …

---

## [Reading sockets asynchronously](https://discourse.julialang.org/t/reading-sockets-asynchronously/92096)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 6\
**Last updated:** [January 12, 2023, 5:05am UTC](https://discourse.julialang.org/t/reading-sockets-asynchronously/92096 "2023-01-12T05:05:24Z")

</div>

I’m using readavailable() within a loop to read messages from a tcp socket as they come in. Is there a version that doesn’t require a loop ? i.e. something that will call a function asynchronously with the incoming mes…

---

## [Linux raw socket](https://discourse.julialang.org/t/linux-raw-socket/91044)

<div class="topic-metadata">

**Author:** [@gmouts](https://discourse.julialang.org/u/gmouts)\
**Replies:** 5\
**Last updated:** [November 30, 2022, 4:45pm UTC](https://discourse.julialang.org/t/linux-raw-socket/91044 "2022-11-30T16:45:15Z")

</div>

Is there a way to open a raw linux socket through Julia? From the documentation, it seems that the answer to my question is no, but I wanted to double check.

---

## [How to pass a buffer to a C callback function?](https://discourse.julialang.org/t/how-to-pass-a-buffer-to-a-c-callback-function/87716)

<div class="topic-metadata">

**Author:** [@tt1234567](https://discourse.julialang.org/u/tt1234567)\
**Replies:** 10\
**Last updated:** [September 27, 2022, 10:27am UTC](https://discourse.julialang.org/t/how-to-pass-a-buffer-to-a-c-callback-function/87716 "2022-09-27T10:27:00Z")

</div>

Following my question in Help with real-time performance needed - #16 by tt1234567, I’ve been thinking about writing a non-allocating recv\_into! function to receive a UDP packet into an existing buffer without creating a…

---

## [Help with real-time performance needed](https://discourse.julialang.org/t/help-with-real-time-performance-needed/87635)

<div class="topic-metadata">

**Author:** [@tt1234567](https://discourse.julialang.org/u/tt1234567)\
**Replies:** 20\
**Last updated:** [September 25, 2022, 7:14pm UTC](https://discourse.julialang.org/t/help-with-real-time-performance-needed/87635 "2022-09-25T19:14:50Z")

</div>

I have an application which reads sensor data packets from a UDP multicast socket over a dedicated ethernet link, processes them and updates a display using the excellent Makie. This was working fine on our original syst…

---

## [Moving from Genie to HTTP (or a linux socket)](https://discourse.julialang.org/t/moving-from-genie-to-http-or-a-linux-socket/84341)

<div class="topic-metadata">

**Author:** [@gmouts](https://discourse.julialang.org/u/gmouts)\
**Replies:** 0\
**Last updated:** [July 17, 2022, 1:33am UTC](https://discourse.julialang.org/t/moving-from-genie-to-http-or-a-linux-socket/84341 "2022-07-17T01:33:58Z")

</div>

I want to have a deamon running on a server and I would like to be able to change some parameters without restarting it. My guess was that the best way to do that was by using a socket. I played a bit with genie and I e…

---

## [How to send binary data by socket with Genie?](https://discourse.julialang.org/t/how-to-send-binary-data-by-socket-with-genie/79098)

<div class="topic-metadata">

**Author:** [@D\_A](https://discourse.julialang.org/u/D_A)\
**Replies:** 1\
**Last updated:** [April 6, 2022, 2:26pm UTC](https://discourse.julialang.org/t/how-to-send-binary-data-by-socket-with-genie/79098 "2022-04-06T14:26:22Z")

</div>

Hello, I am developing a small web application which consists of a simple page with a form, where the user has to check some boxes but mostly choose files to upload to the server so that the server runs a process and se…

---

## [Using Julia Sockets to send message to an existing TCP Socket](https://discourse.julialang.org/t/using-julia-sockets-to-send-message-to-an-existing-tcp-socket/76191)

<div class="topic-metadata">

**Author:** [@hanshinlee77](https://discourse.julialang.org/u/hanshinlee77)\
**Replies:** 9\
**Last updated:** [February 13, 2022, 12:54am UTC](https://discourse.julialang.org/t/using-julia-sockets-to-send-message-to-an-existing-tcp-socket/76191 "2022-02-13T00:54:14Z")

</div>

Hi, I have a problem to send a simple message to an existing TCP server, using Julia Sockets module. I used one of the “C” examples on the web to test if I can make a connection and send/receive messages to/from the ser…

---

## [Using the Sockets](https://discourse.julialang.org/t/using-the-sockets/75317)

<div class="topic-metadata">

**Author:** [@MeteorBizone](https://discourse.julialang.org/u/MeteorBizone)\
**Replies:** 1\
**Last updated:** [January 27, 2022, 8:17pm UTC](https://discourse.julialang.org/t/using-the-sockets/75317 "2022-01-27T20:17:59Z")

</div>

How can I create a TCP socket and TCP server with a ip-address and port?

---

## [Concurrency violation detect](https://discourse.julialang.org/t/concurrency-violation-detect/67678)

<div class="topic-metadata">

**Author:** [@Beh123](https://discourse.julialang.org/u/Beh123)\
**Replies:** 1\
**Last updated:** [September 4, 2021, 1:00pm UTC](https://discourse.julialang.org/t/concurrency-violation-detect/67678 "2021-09-04T13:00:32Z")

</div>

Hi everyone. I have 2 threads. First, is reading data from udp. Second, process data. When I use @distributed before loops, I have concurrency violation. This is my code. using Distributed , Sockets using ThreadPo…

---

## [RPC API in Julia?](https://discourse.julialang.org/t/rpc-api-in-julia/52352)

<div class="topic-metadata">

**Author:** [@sairus7](https://discourse.julialang.org/u/sairus7)\
**Replies:** 4\
**Last updated:** [July 18, 2021, 8:33pm UTC](https://discourse.julialang.org/t/rpc-api-in-julia/52352 "2021-07-18T20:33:40Z")

</div>

How can I write a simple RPC server in Julia? As far as I can see, I need the following parts: I/O transport (pipes / sockets / websockets / ZMQ / etc.) Serialization protocol (JSON / BSON / MsgPack / Protobuf), and R…

---

## [Anyone used sockets to listen for python3 objects?](https://discourse.julialang.org/t/anyone-used-sockets-to-listen-for-python3-objects/54231)

<div class="topic-metadata">

**Author:** [@anon69491625](https://discourse.julialang.org/u/anon69491625)\
**Replies:** 4\
**Last updated:** [January 30, 2021, 11:35am UTC](https://discourse.julialang.org/t/anyone-used-sockets-to-listen-for-python3-objects/54231 "2021-01-30T11:35:51Z")

</div>

Hi all just coded up a simple python script that posts to a socket ,every 5 seconds, a message containing the following objects. integer unixdatetime float64 string 20 bytes float64 writing a listener python progr…

---

## [Use \`mitmproxy\` with Julia AWS.jl](https://discourse.julialang.org/t/use-mitmproxy-with-julia-aws-jl/50524)

<div class="topic-metadata">

**Author:** [@Roger-luo](https://discourse.julialang.org/u/Roger-luo)\
**Replies:** 0\
**Last updated:** [November 21, 2020, 4:58am UTC](https://discourse.julialang.org/t/use-mitmproxy-with-julia-aws-jl/50524 "2020-11-21T04:58:11Z")

</div>

I was trying to use mitmproxy to debug a AWS connection issue, however it produces the following error, any idea why? ERROR: DNSError: , unknown node or service (EAI\_NONAME) Stacktrace: \[1\] getalladdrinfo(::String) at …

---

## [Read-all echo TCP server](https://discourse.julialang.org/t/read-all-echo-tcp-server/47107)

<div class="topic-metadata">

**Author:** [@julbinb](https://discourse.julialang.org/u/julbinb)\
**Replies:** 8\
**Last updated:** [September 23, 2020, 10:23pm UTC](https://discourse.julialang.org/t/read-all-echo-tcp-server/47107 "2020-09-23T22:23:50Z")

</div>

I need to write a Julia server that reads the entire message coming from a client, and then sends a reply back. However, it seems that when the message is read, the socket gets closed, so I can’t write the reply. Server…

---

## [How to wait on multiple file descriptors/streams](https://discourse.julialang.org/t/how-to-wait-on-multiple-file-descriptors-streams/46827)

<div class="topic-metadata">

**Author:** [@HanD](https://discourse.julialang.org/u/HanD)\
**Replies:** 0\
**Last updated:** [September 18, 2020, 7:42am UTC](https://discourse.julialang.org/t/how-to-wait-on-multiple-file-descriptors-streams/46827 "2020-09-18T07:42:41Z")

</div>

Hello all, I’m trying to read from multiple sockets/file descriptors, and would like to wait for either of them to have available bytes, then read them, and go back to waiting. In a regular posix system, I would use sel…

---

## [Properly connect Julia processes in multiple machines with Sockets](https://discourse.julialang.org/t/properly-connect-julia-processes-in-multiple-machines-with-sockets/38487)

<div class="topic-metadata">

**Author:** [@martincornejo](https://discourse.julialang.org/u/martincornejo)\
**Replies:** 4\
**Last updated:** [April 30, 2020, 5:00pm UTC](https://discourse.julialang.org/t/properly-connect-julia-processes-in-multiple-machines-with-sockets/38487 "2020-04-30T17:00:34Z")

</div>

Using the Sockets and Serialization libraries, I’m able to connect two Julia processes and exchange data between them. To connect two Julia processes in the same machine I can do the following: Julia process A sckt = a…
