How can I have two PC's communicate wirelessly on the same network in C#?

Thread Starter


Joined Apr 24, 2021
I'm trying to write a program that has a PC set up as a server and another PC set up as a client. The server will have a local file stored on it that contains some sort of storage information. The server and client are wirelessly connected to the same wifi network.

I want the client to be able to send requests for information to the server, have the server pick out the requested information from the local file, and send it to the client. The client is just displaying the information to the user.

Now my question is, how can I achieve something like this in C# winforms app?

I'm a bit new to networking in general and just need to be pointed in the right direction. There's a lot of information on the internet and I don't know where to start.


Joined Oct 5, 2017
If the connections are both to a common network server, then the 'wireless' aspect of it should be irrelevant to you, and you will just communicate as you would over any local network.

If you don't have fixed IP addresses then there are a number of protocols to establish communication in that scenario.


Joined Oct 6, 2013
I have no experience with C# and very little experience with Windows, but can give you the basic flow of how you would do it with GNU C on a Linux system. I have a feeling that Windows is going to have similar steps although they probably won't look remotely close.

On the server:
-- use the socket() function to create a socket
-- use the bind() function to set the socket address
-- use the listen() function to listen for new connections
-- use the accept() function to connect to incoming connection requests

On the client:
-- use the socket() function to create a socket
-- use the connect() function to connect to the server socket

I know this is a gross oversimplification to some extent. Normally I would add code so that the server does not block at the accept() function and is able to do other things and process new connections as they are requested. Once you establish the connection how you read / write between the two computers is totally up to you. Keep in mind you will need to include your data length in your message so that the other end knows how many bytes it will need to read to retrieve the message and keep everything in sync.

My explanation probably makes it clear as mud, but I thought a basic flow would help pick out the important parts of the examples you will find online.