获取当前目录
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); } }