Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

السيرفر 1

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.Net.Sockets;

namespace server
{
class Program
{
static void Main(string[] args)
{
Socket server = new
Socket(AddressFamily.InterNetwork ,SocketType.Stream ,ProtocolType.Tcp);
IPEndPoint eip = new IPEndPoint(IPAddress.Parse("127.0.0.1"),2000);
server.Bind(eip);
server.Listen(20);
Console.WriteLine("server is running ");
Socket s = server.Accept();

byte[] data = new byte[1024];


s.Receive(data);
Console.WriteLine(Encoding.ASCII.GetString(data));
Console.ReadKey();
s.Close();
server.Close();

}
}
}

‫ هذا الكود حق الخادم السيرفر باستخدام السوكت في‬TCP

You might also like