byte[] fileNameByte = Encoding.ASCII.GetBytes(e.FullPath); byte[] fileData = File.ReadAllBytes(e.FullPath); byte[] clientData = new byte[4 + e.Name.Length + fileData.Length]; byte[] fileNameLen = BitConverter.GetBytes(fileNameByte.Length); m_socWorker = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP); String szIPSelected = "192.168.0.1"; String szPort = "33333"; try { 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); m_socWorker.Connect(remoteEndPoint); } catch (System.Net.Sockets.SocketException se) { Console.WriteLine(se.Message); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)