using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace WinSocketServer
{
public partial class FmServer : Form
{
Thread mythread;
Socket socket;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Threading;
using System.Net.Sockets;
using System.IO;
namespace DevScoketClient
{
public partial class FmClient : Form
{
Socket socket;
IPEndPoint iep;
public FmClient()
{
InitializeComponent();
}
private void btnConnect_Click(object sender, EventArgs e)
{
string ip = this.tbIP.Text;
string port = this.tbPort.Text;
try
{
IPAddress serverIp = IPAddress.Parse(ip);
int serverPort = Convert.ToInt32(port);
iep = new IPEndPoint(serverIp, serverPort);
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Connect(iep);
socket.Send(Encoding.ASCII.GetBytes(tbInfo.Text.Trim()));
socket.Shutdown(SocketShutdown.Both);
socket.Close();