日期:2014-05-17 浏览次数:21330 次
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using SmsSrv;
using System.IO;
namespace Server
{
public partial class Form1 : Form
{
String recivevalue = string.Empty;
IPEndPoint clientipe;
String telenum, mess;
Thread thread;
//SmsMgr sms;
public Form1()
{
InitializeComponent();
thread = new Thread(new ThreadStart(Listen));
thread.IsBackground = true;
thread.Start();
}
public void Listen()
{
Socket listen_pro = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPAddress localaddr = Dns.GetHostEntry(Dns.GetHostName()).AddressList[0];
IPEndPoint ipendpoint = new IPEndPoint(IPAddress.Parse("192.168.10.111"), 2012);
listen_pro.Bind(ipendpoint);
listen_pro.Listen(10);
Byte[] recived = new Byte[1024];
while (true)
{
while (true)
{
Socket socket = listen_pro.Accept();
int