zoukankan      html  css  js  c++  java
  • c#代码片段

    获取当前目录
    var a = AppDomain.CurrentDomain.BaseDirectory; var c = Directory.GetCurrentDirectory(); Directory.SetCurrentDirectory("c:/"); var d = Directory.GetCurrentDirectory();

    .net mvc ajaxhelper
    刷整页的问题,要引入jquery.unobtrusive-ajax.min.js

    socket

    Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
    client.BeginConnect(ipAddress, port, new AsyncCallback(ConnectCallback), so);
    
    
    private static void ConnectCallback(IAsyncResult ar)
            {
    
                    Socket client = (Socket)ar.AsyncState;
    
                    byte[] fileBuffer = so.fileBuffer;
    
                    // Complete the connection.
                    so.workSocket.EndConnect(ar);
    
    
                    // Signal that the connection has been made.
                    connectDone.Set();
    
                    so.workSocket.BeginSend(fileBuffer, 0, fileBuffer.Length, SocketFlags.None, new AsyncCallback(SendCallback), so);
    
            }
    
    private static void SendCallback(IAsyncResult ar)
            {
                SmsDao sd = new SmsDao();
                StateObject so = (StateObject)ar.AsyncState;
                try
                {
                    // Retrieve the socket from the state object.
    
                    // Complete sending the data to the remote device.
                    int bytesSent = so.workSocket.EndSend(ar);
                    Console.WriteLine("Sent {0} bytes to server.", bytesSent);
    
                    // Signal that all bytes have been sent.
                    sendDone.Set();
                    if (so.fileBuffer.Length == bytesSent)
                    {
                        sd.updatePushStatus(so.orderID, "1", DateTime.Now.ToString("HHmmss.fff"));
                    }
                    else
                    {
                        sd.updatePushStatus(so.orderID, "-1", "发送长度错误" + DateTime.Now.ToString("HHmmss.fff"));
                    }
    
                    so.workSocket.Shutdown(SocketShutdown.Both);
                    so.workSocket.Close();
                    //Receive(client);
                }
            }
  • 相关阅读:
    30款超酷的HTTP 404页面未找到错误设计
    java与java学习路线
    程序员最核心的竞争力
    群智能优化算法-测试函数matlab源码
    如何用Latex合并多个pdf文件?
    Latex--TikZ和PGF--高级文本绘图,思维绘图,想到--得到!
    学无止境 气有浩然
    Latex中定义、定理、引理、证明 设置方法总结
    WeUI
    微信JS SDK Demo 官方案例
  • 原文地址:https://www.cnblogs.com/yy2056/p/4098842.html
Copyright © 2011-2022 走看看