Skip to content

Instantly share code, notes, and snippets.

@one-harsh
Created March 5, 2015 09:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save one-harsh/7e8c8702e648a58a64fc to your computer and use it in GitHub Desktop.
Save one-harsh/7e8c8702e648a58a64fc to your computer and use it in GitHub Desktop.
using System;
using System.Net.Sockets;
using System.Text;
namespace DummySocketClient
{
public class Program
{
public static void Main(string[] args)
{
using(TcpClient client = new TcpClient("127.0.0.1", 37517)) // Change the IP and port according to your needs.
{
client.SendTimeout = 3;
using(NetworkStream stream = client.GetStream())
{
byte[] data = new byte[4096];
string response = "";
int bytes = stream.Read(data, 0, data.Length);
response = Encoding.ASCII.GetString(data, 0, bytes);
Console.WriteLine(response);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment