• 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);
                }
            }
  • 相关阅读:
    Halcon 如何将图像转化为矩阵形式
    Halcon 图像分割
    Halcon intensity算子,用于计算灰度的均值和方差
    Halcon draw_region接口
    Halcon scale_image 函数用法技巧
    Halcon 保存图像
    Halcon 读取多张图片
    Halcon 算子 sub_image add_image mult_image div_image
    Halcon 算子 get_grayval 用于读取图像的灰度值
    Halcon 算子 convert_image_type 转换图像类型
  • 原文地址:https://www.cnblogs.com/yy2056/p/4098842.html
Copyright © 2020-2023  润新知