• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Net.IPEndPoint类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Net.IPEndPoint的典型用法代码示例。如果您正苦于以下问题:C# System.Net.IPEndPoint类的具体用法?C# System.Net.IPEndPoint怎么用?C# System.Net.IPEndPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



System.Net.IPEndPoint类属于命名空间,在下文中一共展示了System.Net.IPEndPoint类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DotNetPosMain

        /// <summary>
        /// 
        /// </summary>
        /// <param name="endPointIP">Sender IPAddress</param>
        /// <param name="endPointPort">Sender Port</param>
        /// <param name="messageType">Message Type:
        /// ISO8583.
        /// XML.
        /// EXCEL.</param>
        public DotNetPosMain(string endPointIP, int endPointPort, MessageType messageType)
        {
            _msgType = messageType;

            destinationEndPoint =
               new System.Net.IPEndPoint(System.Net.IPAddress.Parse(endPointIP), endPointPort);
        }
开发者ID:AlirezaP,项目名称:DotNetPos,代码行数:16,代码来源:DotNetPos.cs


示例2: WriteLog

        public static void WriteLog(string sApplicationName, string sMsg)
        {
            lock (typeof(CarverLabUtility.Logger))
            {
                string FILENAME = @"c:\" + sApplicationName + ".log";
                System.IO.StreamWriter fsw;
                string sOut = "[" + System.DateTime.Now.ToString("G") + "] " + sMsg;

                if (System.IO.File.Exists(FILENAME))
                {
                    fsw = System.IO.File.AppendText(FILENAME);
                }
                else
                {
                    fsw = System.IO.File.CreateText(FILENAME);
                }
                fsw.WriteLine(sOut);
                fsw.Close();
                System.Diagnostics.Trace.WriteLine(sMsg);

                System.Net.IPEndPoint ipep = new System.Net.IPEndPoint(System.Net.IPAddress.Loopback,61288);
                System.Net.Sockets.UdpClient uc = new System.Net.Sockets.UdpClient(System.Net.Sockets.AddressFamily.InterNetwork);
                uc.Send(System.Text.Encoding.ASCII.GetBytes(sOut),sOut.Length,ipep);
            }
        }
开发者ID:CarverLab,项目名称:Oyster,代码行数:25,代码来源:Logger.cs


示例3: Client

 internal Client(NetStream stream, String user, Int32 sec, System.Net.IPEndPoint ip)
 {
     Stream = stream;
     Username = user;
     SecurityLevel = sec;
     Ip = ip;
 }
开发者ID:nyoung3,项目名称:BukkitService,代码行数:7,代码来源:Client.cs


示例4: Main

        static void Main(string[] args)
        {
            Client c = new Client();

            try
            {
                //create a new client socket ...
                c.m_socClient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                String szIPSelected = "127.0.0.1";
                String szPort = "8221";
                int alPort = System.Convert.ToInt16(szPort, 10);

                System.Net.IPAddress remoteIPAddress = System.Net.IPAddress.Parse(szIPSelected);
                System.Net.IPEndPoint remoteEndPoint = new System.Net.IPEndPoint(remoteIPAddress, alPort);
                c.m_socClient.Connect(remoteEndPoint);
                String szData = "Hello There";
                Console.WriteLine("Sending message");
                byte[] byData = System.Text.Encoding.UTF8.GetBytes(szData);
                c.m_socClient.Send(byData);
                Console.WriteLine("Sent");
                c.m_socClient.Close();
            }
            catch (SocketException se)
            {
                Console.WriteLine(se.Message);
            }
        }
开发者ID:andhikanugraha,项目名称:tetembakan,代码行数:27,代码来源:Client.cs


示例5: connect_Click

 private void connect_Click(object sender, EventArgs e)
 {
     byte[] buff = new byte[255];
     System.Net.IPEndPoint IP = new System.Net.IPEndPoint(System.Net.IPAddress.Parse(txtIP.Text),Convert.ToInt32(txtPort.Text));
     telnet.Connect(IP,txtsysop.Text,txtlock.Text);
     timRecv.Enabled = true;
 }
开发者ID:elitak,项目名称:NoxTools,代码行数:7,代码来源:Form1.cs


示例6: SDL

        public SDL()
        {
            Initialise();
            
            #region Connect To Server
            System.Net.IPEndPoint tempIpAddress = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("127.0.0.1"), 8001);
            Stromohab_MCE_Connection.TCPProcessor.ConnectToServer(tempIpAddress);
            
            Stromohab_MCE_Connection.SendMCECommand.StartCameras();
            Stromohab_MCE_Connection.TCPProcessor.JointListReceivedEvent += new Stromohab_MCE_Connection.TCPProcessor.JointListReceivedHandler(TCPProcessor_JointListReceivedEvent);
            Stromohab_MCE_Connection.TCPProcessor.TrackableListReceivedEvent += new Stromohab_MCE_Connection.TCPProcessor.TrackableListReceivedHandler(TCPProcessor_TrackableListReceivedEvent);
            #endregion Connect To Server
            
            
            #region Remoting
            //Register for events and pre-set all trackables to draw

            
            ChannelServices.RegisterChannel(new TcpChannel(8008),false);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(OpenGLViewer.OpenGLViewerRemoteControl), "Remote", WellKnownObjectMode.Singleton);

            

            #endregion Remoting
            
        }
开发者ID:matalangilbert,项目名称:stromohab-2008,代码行数:26,代码来源:SDL.cs


示例7: Send

        static void Send(List<GPSDataEntity> data ,string datatype)
        {
            MemoryStream ms = new MemoryStream();//创建内存流对象
            new BinaryFormatter().Serialize(ms, data);//将序列化信息放入内存流
            byte[] bytes = ms.ToArray();

            string businessIP = ConfigHelper.GetConfig("businessServerIP");
            int businessPort = int.Parse(ConfigHelper.GetConfig("businessserverport"));
            string protocolType = ConfigHelper.GetConfig("protocolType");
            if (protocolType == "udp")
            {
                System.Net.IPEndPoint business = new System.Net.IPEndPoint(System.Net.IPAddress.Parse(businessIP), businessPort);
                udp.SendTo(business, bytes);
                System.Console.WriteLine("udp send " + dataQty + " " + datatype + " " + bytes.Length + " bytes to business ok");
            }
            else if (protocolType == "tcp")
            {
                System.Net.Sockets.NetworkStream ns = tcp.GetStream();
                ns.Write(bytes, 0, bytes.Length);
                ns.Flush();
                //ns.Close();
                System.Console.WriteLine("tcp send " + dataQty + " " + datatype + " " + bytes.Length + " bytes to business ok");
            }

            System.Threading.Thread.Sleep(sendinterval);
        }
开发者ID:hhahh2011,项目名称:CH.Gps,代码行数:26,代码来源:Program.cs


示例8: RunServer

        static void RunServer()
        {
            System.Net.IPEndPoint anyIP = new System.Net.IPEndPoint(System.Net.IPAddress.Any, 0);
            System.Net.Sockets.UdpClient udpListener = new System.Net.Sockets.UdpClient(514);
            byte[] bReceive; string sReceive; string sourceIP;

            /* Main Loop */
            /* Listen for incoming data on udp port 514 (default for SysLog events) */
            while (true)
            {
                try
                {
                    bReceive = udpListener.Receive(ref anyIP);
                    
                    // Convert incoming data from bytes to ASCII
                    sReceive = System.Text.Encoding.ASCII.GetString(bReceive);
                    
                    // Get the IP of the device sending the syslog
                    sourceIP = anyIP.Address.ToString();

                    // Start a new thread to handle received syslog event
                    new System.Threading.Thread(new logHandler(sourceIP, sReceive).handleLog).Start();
                    
                }
                catch (System.Exception ex) 
                { 
                    System.Console.WriteLine(ex.ToString()); 
                }
            } // Whend

        } // End Sub Main 
开发者ID:ststeiger,项目名称:SyslogClients,代码行数:31,代码来源:Server.cs


示例9: MainForm_Load

 private async void MainForm_Load(object sender, EventArgs e)
 {
     var endPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Loopback, 1380);
     var state = await RemoteServer.Instance.Connect(endPoint);
     var version = state ? await RemoteServer.Instance.GetVersion() : null;
     this.Text = state ? ("服务版本:" + version) : "连接服务器失败 ..";
     this.btn_Login.Enabled = this.btn_Pass.Enabled = state;
 }
开发者ID:JackWangCUMT,项目名称:NetworkSocket,代码行数:8,代码来源:MainForm.cs


示例10: ConnectToServer

 public void ConnectToServer()
 {
     soc = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     //ipAdd = System.Net.IPAddress.Parse("10.1.70.50");
     ipAdd = System.Net.IPAddress.Parse("192.168.0.18");
     remoteEP = new System.Net.IPEndPoint(ipAdd, 1337);
     soc.Connect(remoteEP);
 }
开发者ID:nigandhi,项目名称:Node.js-based-Chat-Application,代码行数:8,代码来源:MainWindow.xaml.cs


示例11: Socket

        public Socket(String host, int port)
        {
            System.Net.IPHostEntry hostEntry = System.Net.Dns.GetHostEntry (host);
            System.Net.IPAddress serverIP =  hostEntry.AddressList [0];
            System.Net.IPEndPoint serverEP = new System.Net.IPEndPoint(serverIP,port);

            this.delegateInstance = new System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Stream, System.Net.Sockets.ProtocolType.Tcp);
        }
开发者ID:sailesh341,项目名称:JavApi,代码行数:8,代码来源:Socket.cs


示例12: SetSettings

 /// <summary>
 /// will want to catch exception that occur in here and let someone know
 /// </summary>
 /// <param name="settings"></param>
 public void SetSettings(ChiefMarleyControllerSettings settings)
 {
     // set addressing
     System.Net.IPAddress ipAddr;
     ipAddr = System.Net.IPAddress.Parse(settings.IpAddress);
     System.Net.IPEndPoint endPoint = new System.Net.IPEndPoint(ipAddr, settings.Port);
     addressing1.SetConnection(endPoint);
 }
开发者ID:fiveohhh,项目名称:MarleyController,代码行数:12,代码来源:Settings.xaml.cs


示例13: bw_DoWork

        private void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                byte[] buf;
                if (random == true)
                {
                    buf = System.Text.Encoding.ASCII.GetBytes(String.Format(Data, new Functions().RandomString()));
                }
                else
                {
                    buf = System.Text.Encoding.ASCII.GetBytes(Data);
                }

                var RHost = new System.Net.IPEndPoint(System.Net.IPAddress.Parse(IP), Port);
                while (IsFlooding)
                {
                    Socket socket = null;
                    if (Protocol == 1)
                    {
                        socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                        socket.NoDelay = true;

                        try { socket.Connect(RHost); }
                        catch { continue; }

                        socket.Blocking = Resp;
                        try
                        {
                            while (IsFlooding)
                            {
                                FloodCount++;
                                socket.Send(buf);
                                if (Delay >= 0) System.Threading.Thread.Sleep(Delay+1);
                            }
                        }
                        catch { }
                    }
                    if (Protocol == 2)
                    {
                        socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
                        socket.Blocking = Resp;
                        try
                        {
                            while (IsFlooding)
                            {
                                FloodCount++;
                                socket.SendTo(buf, SocketFlags.None, RHost);
                                if (Delay >= 0) System.Threading.Thread.Sleep(Delay+1);
                            }
                        }
                        catch { }
                    }
                }
            }
            catch { }
        }
开发者ID:shinkitsunemaru,项目名称:LOIC,代码行数:57,代码来源:XXPFlooder.cs


示例14: ConnectEvent

 public void ConnectEvent()
 {
     Socket.ConnectEvent ev = EventFactory.CreateFromXml(TestEventXml.E084_Connect) as Socket.ConnectEvent;
     Assert.That(ev, Is.Not.Null);
     Assert.That(ev.Socket, Is.EqualTo(0x8ac));
     System.Net.IPEndPoint expectedEndpoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("65.54.239.20"), 1863);
     Assert.That(ev.RemoteEndPoint, Is.EqualTo(expectedEndpoint));
     Assert.That(ev.Result, Is.EqualTo(Socket.ConnectResult.WouldBlock));
 }
开发者ID:SayHalou,项目名称:ospy,代码行数:9,代码来源:SocketEventTest.cs


示例15: Main

 static void Main(string[] args)
 {
     System.Net.IPEndPoint ep = new System.Net.IPEndPoint(System.Net.IPAddress.Any, 4004);
     SyslogDaemon daemon = new SyslogDaemon(ep, Encoding.UTF8);
     IServerStatus istatus = (IServerStatus)daemon;
     ServerStatusLogger logger = new ServerStatusLogger(ref istatus, Encoding.UTF8);
     logger.LogEntryAdded += new EventHandler<Just.EventArguments.StringEventArgs>(logger_LogEntryAdded);
     daemon.StartReceiving();
     Console.Read();
 }
开发者ID:dohjo,项目名称:NTPR,代码行数:10,代码来源:Program.cs


示例16: ToArray

 /// <summary>
 /// to array
 /// </summary>
 /// <returns></returns>
 public System.Net.IPEndPoint[] ToArray()
 {
     var endpoints = new System.Net.IPEndPoint[base.Count];
     for (int i = 0, l = this.Count; i < l; i++)
     {
         var child = this[i];
         endpoints[i] = new System.Net.IPEndPoint(System.Net.IPAddress.Parse(child.Host), child.Port);
     }
     return endpoints;
 }
开发者ID:geffzhang,项目名称:Thrift.Net,代码行数:14,代码来源:EndPointCollection.cs


示例17: Connect

 //建议Socket连接
 private void Connect()
 {
     //连接服务器主机
     this.socket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType .Tcp );
     System.Net.IPAddress IP = System.Net .IPAddress .Parse (this.host);
     System.Net.IPEndPoint ipe = new System.Net.IPEndPoint(IP, port);
     this.socket.SendTimeout = timeout;
     this.socket.ReceiveTimeout = timeout;
     this.socket.Connect(ipe);
 }
开发者ID:koalas8,项目名称:OpenPOS,代码行数:11,代码来源:MySocket.cs


示例18: ListenThreadProc

        static void ListenThreadProc()
        {

            bool keepgoing = true;
            while (keepgoing)
            {
                try
                {
                    if (lsock != null)
                    {
                        lsock.Close();
                    }

                    lsock = new System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily.InterNetwork,
                        System.Net.Sockets.SocketType.Stream, System.Net.Sockets.ProtocolType.Tcp);
                    System.Net.IPEndPoint ipep = new System.Net.IPEndPoint(System.Net.IPAddress.Any, 55905);
                    for (int i = 0; ; i++)
                    {
                        try
                        {
                            lsock.Bind(ipep);
                            break;
                        }
                        catch
                        {
                            if (i >= 5)
                            {
                                throw;
                            }
                            System.Threading.Thread.Sleep(1000 * 4);
                            continue;
                        }
                    }

                    lsock.Listen(30);

                    for (; ; )
                    {
                        System.Net.Sockets.Socket dllclientSock = lsock.Accept();
                        DfsProtocolClientHandler ch = new DfsProtocolClientHandler();
                        System.Threading.Thread cthd = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(ch.ClientThreadProc));
                        cthd.IsBackground = true;
                        cthd.Start(dllclientSock);
                    }
                }
                catch (System.Threading.ThreadAbortException e)
                {
                    keepgoing = false;
                }
                catch (Exception e)
                {
                    XLog.errorlog("DfsProtocol.ListenThreadProc exception: " + e.ToString());
                }
            }
        }
开发者ID:erisonliang,项目名称:qizmt,代码行数:55,代码来源:DfsProtocol.cs


示例19: MainForm_Load

        private async void MainForm_Load(object sender, EventArgs e)
        {
            RemoteServer.Instance.Serializer = new FastJsonSerializer();

            var endPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Loopback, 1350);
            var state = await RemoteServer.Instance.Connect(endPoint);
            var version = state ? await RemoteServer.Instance.GetVersion() : "未知";

            this.Text = "连接" + (state ? "成功" : "失败") + " 服务版本:" + version;
            this.btn_Login.Enabled = this.btn_Pass.Enabled = state;
        }
开发者ID:dzvane,项目名称:NetworkSocket,代码行数:11,代码来源:MainForm.cs


示例20: SensorBase

        public SensorBase(int id, string sensorname, System.Net.IPEndPoint endpoint )
        {
            this.ComType = COMTYPE.TCP;
               this.SensorName = sensorname;
               this.endpoint = endpoint;

               new System.Threading.Thread(TCPConnectTask).Start();
               ID = id;
               OneMinTmr.Interval = 1000 * 60;
               OneMinTmr.Elapsed += new System.Timers.ElapsedEventHandler(OneMinTmr_Elapsed);
               OneMinTmr.Start();
        }
开发者ID:ufjl0683,项目名称:Center,代码行数:12,代码来源:SensorBase.cs



注:本文中的System.Net.IPEndPoint类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Mail.MailAddress类代码示例发布时间:2022-05-24
下一篇:
C# Http.HttpClient类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap