Example #1
0
        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;
                    }
                }
            }
        }
Example #2
0
        public BlinkCallBack(Socket socket)
        {
            SocketLink = socket;
            Conn       = Blink.NewConnection(socket,
                                             2 * 1024 * 1024,
                                             "D:/",
                                             Guid.NewGuid().ToString(),
                                             0.1f,
                                             this, this);

            mBlinkCallBacks.Add(this);
        }
Example #3
0
        static void Main(string[] args)
        {
            BlinkLog.I("=========PRESS ENTER IP eg(127.0.0.1)==========");
            string ip = Console.ReadLine();

            IPAddress hostIp;

            if (!IPAddress.TryParse(ip, out hostIp))
            {
                Console.ReadKey();
                return;
            }

            try
            {
                mSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                mSocket.Connect(hostIp, 2626);
                mBlinkConn = Blink.NewConnection(mSocket, 1024 * 1024, "D:/", Guid.NewGuid().ToString(), 0.01f, null, null);
            }
            catch (Exception)
            {
                BlinkLog.I("LINK TO: " + hostIp + " ERROR.");
                Console.ReadKey();
                return;
            }

            BlinkLog.I("=========PRESS ENTER 'E' TO EXIT==========");

            SendWhlie();


            if (mBlinkConn != null)
            {
                mBlinkConn.Dispose();
            }
            if (mSocket != null)
            {
                mSocket.Dispose();
                mSocket.Close();
            }
        }