DEV Community

rderik
rderik

Posted on

2

Using BSD Sockets in Swift

There are a number of network APIs and frameworks provided by Apple. The newest being Network.framework, it allows us to work on the transport layer of the network stack. This gives us access to lower levels of the network stack than what most applications will need. But sometimes that is even higher than what we need. Maybe we need to interoperate directly with native sockets.

There are not many examples of how to use BSD sockets in Swift, so I put together an example to create a server and a client using BSD sockets in Swift. You can check the original article here:

https://rderik.com/blog/using-bsd-sockets-in-swift/

It is not common to have to do that type of low-level networking, but when you find yourself in need of an example you'll be happy to have one.

I hope it's useful. Let me know what you think. Also, if you know someone that might find it interesting, please share it.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

Retry later
Retry later