static void Run() { Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPAddress HostIp = IPAddress.Parse("127.0.0.1"); socket.Connect(HostIp, 2626); BlinkConn conn = Blink.NewConnection(socket, 1024 * 1024, "D:/", Guid.NewGuid().ToString(), 0.001f, null, null); if (conn != null) { Console.WriteLine("Test Send String..."); for (int i = 0; i <= 50; i++) { string str = "Test String:" + i; conn.Send(str); Console.WriteLine(str); Thread.Sleep(2); if (IsExit) { conn.Dispose(); socket.Shutdown(SocketShutdown.Both); socket.Dispose(); socket.Close(); return; } } } }
static void Send(string str) { try { FileInfo info = new FileInfo(str); if (info.Exists) { mBlinkConn.Send(info, new SendCallBack()); } else { mBlinkConn.Send(str); BlinkLog.I("Send String To Server."); } } catch (Exception e) { BlinkLog.E(e.Message); } }