Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try {
- String ip = "192.168.163.44";
- int port = 8001;
- IPAddress ipAd = IPAddress.Parse(ip);
- TcpListener myList = new TcpListener(ipAd, port);
- myList.Start();
- while (true)
- {
- Socket s = myList.AcceptSocket();
- string url = null;
- string[] connection = null;
- string msq = null;
- byte[] dataByte = null;
- int i = 0;
- int numConnection = 0;
- byte[] readBuffer = new byte[s.ReceiveBufferSize];
- List<byte[]> msqList = new List<byte[]>();
- do
- {
- ++i;
- readBuffer = new byte[s.ReceiveBufferSize];
- int numberOfBytesRead = s.Receive(readBuffer);
- msq = null;
- if (i == 1)
- {
- numConnection = Int32.Parse(Encoding.ASCII.GetString(TrimEnd(readBuffer)));
- urltext.Text = numConnection.ToString();
- Debug.WriteLine("recieved: {0}", numConnection);
- }
- } while (i < numConnection);
- s.Close();
- }
- myList.Stop();
- }
- catch (Exception ex)
- {
- Console.WriteLine("Error..... " + ex.StackTrace);
- Console.ReadLine();
- }`
- namespace App2
- {
- public partial class MainPage : ContentPage
- {
- public MainPage()
- {
- InitializeComponent();
- //Here//
- }
- }
- }
Add Comment
Please, Sign In to add comment