32 lines
833 B
C#
32 lines
833 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Net.Sockets;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Connector
|
|
{
|
|
class Receiver
|
|
{
|
|
Int32 port = 80;
|
|
private TcpClient client;
|
|
private NetworkStream inStream;
|
|
Byte[] data;
|
|
|
|
public void receive()
|
|
{
|
|
client = new TcpClient("localhost", port);
|
|
inStream = client.GetStream();
|
|
data = new Byte[256];
|
|
String responseData = String.Empty;
|
|
Int32 bytes = inStream.Read(data, 0, data.Length);
|
|
responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes);
|
|
Console.WriteLine("Received: {0}", responseData);
|
|
inStream.Close();
|
|
client.Close();
|
|
}
|
|
}
|
|
}
|