Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Sockets/C-sharp/sockets-1.cs
Normal file
15
Task/Sockets/C-sharp/sockets-1.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Net.Sockets;
|
||||
|
||||
class Program {
|
||||
static void Main(string[] args) {
|
||||
TcpClient tcp = new TcpClient("localhost", 256);
|
||||
StreamWriter writer = new StreamWriter(tcp.GetStream());
|
||||
|
||||
writer.Write("hello socket world");
|
||||
writer.Flush();
|
||||
|
||||
tcp.Close();
|
||||
}
|
||||
}
|
||||
16
Task/Sockets/C-sharp/sockets-2.cs
Normal file
16
Task/Sockets/C-sharp/sockets-2.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
using System.Text;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace SocketClient
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
sock.Connect("127.0.0.1", 1000);
|
||||
sock.Send(Encoding.ASCII.GetBytes("Hell, world!"));
|
||||
sock.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue