سلام بر برنامه نویسان عزیز ایران زمین 😉 در این مطلب آموزش استفاده از TcpListener در سی شارپ #C را آماده کردم. امیدوارم که این کد برای شما مفید باشد.
کد استفاده از TcpListener در سی شارپ #C :
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
class MainClass
{
public static void Main()
{
int receivedDataLength;
byte[] data = new byte[1024];
TcpListener socket = new TcpListener(9999);
socket.Start();
TcpClient client = socket.AcceptTcpClient();
NetworkStream ns = client.GetStream();
string welcome = "Welcome";
data = Encoding.ASCII.GetBytes(welcome);
using System.Net;
using System.Net.Sockets;
using System.Text;
class MainClass
{
public static void Main()
{
int receivedDataLength;
byte[] data = new byte[1024];
TcpListener socket = new TcpListener(9999);
socket.Start();
TcpClient client = socket.AcceptTcpClient();
NetworkStream ns = client.GetStream();
string welcome = "Welcome";
data = Encoding.ASCII.GetBytes(welcome);