/// <summary> /// send ACTIVE_TEST command to server, test if network is ok and the server is alive /// </summary> /// <param name="sock">the JavaSocket object</param> public static bool activeTest(JavaSocket sock) { byte[] header; header = packHeader(FDFS_PROTO_CMD_ACTIVE_TEST, 0, 0); sock.GetStream().Write(header, 0, header.Length); RecvHeaderInfo headerInfo = recvHeader(sock.GetStream(), TRACKER_PROTO_CMD_RESP, 0); return(headerInfo.errno == 0 ? true : false); }
/// <summary> /// send quit command to server and close socket /// </summary> /// <param name="sock">the JavaSocket object</param> public static void closeSocket(JavaSocket sock) { byte[] header; header = packHeader(FDFS_PROTO_CMD_QUIT, 0, 0); sock.GetStream().Write(header, 0, header.Length); sock.Close(); }