Created
          February 7, 2020 16:39 
        
      - 
      
- 
        Save rdeioris/509180a3c9ffaf123703acc0bc2ab8fb to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| using System.Net; | |
| using System.Net.Sockets; | |
| namespace NetApp001 | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); | |
| IPEndPoint mySelf = new IPEndPoint(IPAddress.Parse("192.168.100.209"), 5000); | |
| socket.Bind(mySelf); | |
| while (true) | |
| { | |
| byte[] data = new byte[4096]; | |
| EndPoint sender = new IPEndPoint(0, 0); | |
| int rlen = socket.ReceiveFrom(data, ref sender); | |
| if (rlen > 0) | |
| { | |
| Console.WriteLine(Encoding.ASCII.GetString(data, 0, rlen)); | |
| } | |
| } | |
| } | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment