public SendMessage ( ByteBuffer buffer ) : void | ||
buffer | ByteBuffer | |
Результат | void |
static void DoSockets() { RECEIVEORDERGATEWAY orderGateway = new RECEIVEORDERGATEWAY(); ConnectMessageModel connectModel = new ConnectMessageModel(); SocketClient socketClient = new SocketClient("membersim.bseindia.com", 8082, new MessageManager(), new TcpReceiver()); socketClient.SendMessage(orderGateway); socketClient.SendMessage(connectModel); GetMarketByPriceModel getMarket = new GetMarketByPriceModel(); socketClient.SendMessage(getMarket); /*GetMarketByPriceModel marketByPrice = new GetMarketByPriceModel(); * marketByPrice.LoginId = 97; * marketByPrice.SessionKey = newOrder.SessionKey; * marketByPrice.KeyIdentifier = newOrder.OEToken + "^" + newOrder.OEBSEToken + "^" + newOrder.OEMarket; * socketClient.SendMessage(marketByPrice); */ /*OrderAndTrade.AddOrder newOrder = new OrderAndTrade.AddOrder(); * AddArbitrageMarketWatchTokensModel arbitrage = new AddArbitrageMarketWatchTokensModel(); * arbitrage.LoginId = 97; * arbitrage.SessionKey = newOrder.SessionKey; * arbitrage.KeyIdentityFier = newOrder.OEToken + "^" + newOrder.OEBSEToken + "^" + newOrder.OEMarket; * socketClient.SendMessage(arbitrage);*/ //Client("Open Market by price=" + marketByPrice.OpenMarketByPrice + "|Internal USID=" + marketByPrice.LoginId + "|SessionKey=" + marketByPrice.SessionKey + "|KeyIdentifier=" + marketByPrice.KeyIdentifier); // Client(marketByPrice.OpenMarketByPrice + "|" + marketByPrice.LoginId + "|" + marketByPrice.SessionKey + "|" + marketByPrice.KeyIdentifier); }
private void XuLyBienSo() { if (openFileDialog1.ShowDialog() == DialogResult.OK) { //var image = capture.QueryFrame().ToBitmap(); var image = Bitmap.FromFile(openFileDialog1.FileName); if (image != null) { if (socketClient != null && socketClient.IsRunning) { // [file name length][file name] [file data] // Buffering ... var fileNameByte = Encoding.UTF8.GetBytes("CM10"); var fileNameLen = BitConverter.GetBytes(fileNameByte.Length); var fileData = GetByteArray(image); var byteToSends = new byte[4 + fileNameByte.Length + fileData.Length]; fileNameLen.CopyTo(byteToSends, 0); fileNameByte.CopyTo(byteToSends, 4); fileData.CopyTo(byteToSends, 4 + fileNameByte.Length); socketClient.SendMessage(byteToSends); } else { MessageBox.Show("ANPR service chưa chạy, thử lại trong vài giây"); StartService("ANPRService", 1000); } } } }
public override void ShutdownConnection() { if (!UseNoSpoolerMode && __started) { socket_client.SendMessage("<CloseConnection/>", 500); } socket_client.Shutdown(); }
public void Start(string drawingID) { _drawingID = new Guid(drawingID); _socket.SendMessage(new Tlv(SocketMessageTypes.StartDrawing, _drawingID)); _editor.Canvas.MouseMove += CanvasOnMouseMove; _editor.Canvas.MouseLeftButtonDown += CanvasOnMouseDown; _editor.StrokeDeleted += EditorOnStrokeDeleted; _editor.StrokedAdded += EditorOnStokeAdded; _timer.Start(); }
public void PauseRecognizer() { if (recognizerPaused) { return; } var message = new ServerActionMessage(); message.Pause = true; client.SendMessage(message); }
public void SendPoint(Point msg) { byte[] bytes = Serialization.Serialize <Point>(msg); MemoryStream ms = new MemoryStream(); BinaryWriter writer = new BinaryWriter(ms); writer.Write((int)ProtocalType.Point); writer.Write(bytes); client.SendMessage(ms.ToArray()); writer.Close(); ms.Close(); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Space)) { socketClient.SendMessage("This is a message sent from Unity client"); } }
static void Main(string[] args) { var server = new SocketServer(10188); (new Thread(() => { var client = new SocketClient("ClientSender", IP_ADDR, 10188); if (client.Login()) { for (int i = 0; i < 2; i++) { Thread.Sleep(TimeSpan.FromSeconds(1)); var recv = client.SendMessage("ClientListener", "请求," + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); } } client.CloseConnection(); })).Start(); Thread.Sleep(TimeSpan.FromSeconds(0.5)); (new Thread(() => { var client = new SocketClient("ClientListener", IP_ADDR, 10188); if (client.Login()) { client.Listen(); } client.CloseConnection(); })).Start(); Thread.Sleep(TimeSpan.FromSeconds(1000)); }
public void ClientSendMessageToServer(string ip, int port, string expected) { // arrange var messageArchive = new MessageArchive(); var server = new SocketServer(ip, port); var client = new SocketClient(ip, port); server.SubscribeToReceivingMessage(delegate(TcpClient client, string message) { messageArchive.AddToRchive(client, message); }); //act var threadServer = new Thread(client.StartChat); threadServer.Start(); var threadClient = new Thread(client.StartChat); threadClient.Start(); client.SendMessage(expected); var actual = messageArchive.Archive.First().Value.First(); //assert Assert.Equal(expected, actual); }
public void SendMessage(System.Object messageObject) { if (!socketClient.IsConnected()) { socketClient.Connect(); } socketClient.SendMessage(JsonConvert.SerializeObject(messageObject)); }
private static void SendMessage() { System.Console.Clear(); Write("Enter your message you want to send to the server... "); var message = System.Console.ReadLine(); _client.SendMessage(message, false); }
static void AddTcpOrder() { ConnectMessageModel connectMessageModel = new ConnectMessageModel(); SocketClient socketClient = new SocketClient("membersim.bseindia.com", 8083, new MessageManager(), new TcpReceiver()); socketClient.SendMessage(connectMessageModel); try { Models.WebSocket.AddOrder order = new Models.WebSocket.AddOrder(); socketClient.SendMessage(order); var messaege = order.Message; } catch (Exception ex) { var exept = ex.Message; } // socketClient.SendMessage(order); }
public void SendDragPos(Vector2 pos) { MessageCommand message = new MessageCommand(1, 1, 8); message.WriteFloat(pos.x); message.WriteFloat(pos.y); socketClient.SendMessage(message); }
public bool SendMessage(UInt32 cmd, object data = null) { if (_client == null) { //Odin.Log.Error("Not Connect Server"); return(false); } return(_client.SendMessage(cmd, data)); }
//---------------------SocketClient-------- public void OnSocketClientConnected(SocketClient b) { //Logger.Debug("Server {0} at {1}:{2} Connected.", type, serverItem.Ip, serverItem.Port); var desc = new ServiceDesc(); desc.Type = (int)MessageType.Connect; desc.ServiceType = 1; b.SendMessage(desc); }
private void SendNetMsg(short mCommand, byte[] mData) { if (AppConst.IsNetConnect) { PackHeader mPackHeader = new PackHeader(); mPackHeader.Pack(PacketConst.SIGN, mData.getValidateCode(), (short)(mData.Length + PacketConst.HeaderLen), mCommand); mSocketClient.SendMessage(new DataPacket(mPackHeader, mData, mData.Length + PacketConst.HeaderLen)); } }
public void OnSocketClientConnectedServer(SocketClient b) { //Logger.Debug("Server {0} at {1}:{2} Connected.", co.Key, server.Ip, server.Port); var desc = new ServiceDesc(); desc.Type = (int)MessageType.Connect; desc.ServiceType = 2; desc.ClientId = (ulong)mId; b.SendMessage(desc); }
private void SocketClientSendMessage() { if (m_SocketClient == null) { return; } MessageCommand messageCommand = new MessageCommand(0, 0, Encoding.UTF8.GetBytes("客户端给服务器发消息")); m_SocketClient.SendMessage(messageCommand); }
public ActionResult Upload(FormCollection forms, HttpPostedFileBase excelfile) { #region "Start Checkpoint" CheckPointApi checkPointApi = new CheckPointApi(); var watch = new Stopwatch(); watch.Start(); checkPointApi.CheckPointNew(UserContext.GetCurrentUser().UserName, "ImportExcel", "Start", 0); #endregion //ViewBag.Filename = fileUpload.FileName; if (excelfile.FileName.EndsWith(".xls") || excelfile.FileName.EndsWith(".xlsx")) { var importInfo = new ImportExcelInfo { UserId = UserContext.GetCurrentUser().UserID, Status = ConvertHelper.ToInt32(forms["Status"]), LevelId = ConvertHelper.ToInt32(forms["LevelId"]), BranchId = ConvertHelper.ToInt32(forms["BranchId"]), ChannelId = ConvertHelper.ToInt32(forms["ChannelId"]), TypeId = ConvertHelper.ToInt32(forms["SourceTypeId"]), CollectorId = ConvertHelper.ToInt32(forms["CollectorId"]), }; var now = DateTime.Now; var fullFileDir = Server.MapPath("/Uploads"); var fullFilePath = Server.MapPath("/Uploads/") + string.Format("{0}_{1}_{2}_{3}_{4}_{5}_", now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second) + excelfile.FileName; if (!Directory.Exists(fullFileDir)) { Directory.CreateDirectory(fullFileDir); } excelfile.SaveAs(fullFilePath); importInfo.TotalRow = 0; importInfo.CheckCount = 0; importInfo.ErrorCount = 0; importInfo.DuplicateCount = 0; importInfo.FilePath = fullFilePath; importInfo.ImportedDate = DateTime.Now; var id = ImportExcelRepository.Create(importInfo); var socketClient = new SocketClient("localhost", Constant.PortImportExcel); socketClient.SendMessage(id.ToString()); ViewBag.Message = id; } else { ViewBag.Message = "InvalidFileFormat"; } #region "End CheckPoint" watch.Stop(); checkPointApi.CheckPointNew(UserContext.GetCurrentUser().UserName, "ImportExcel", "End", watch.ElapsedMilliseconds); #endregion return(View()); }
public bool sendMessage(MensajeServerMensaje m) { var ret = client.SendMessage(m); if (ret == "Success") { salasConectado.Add(m.room); return(true); } return(false); }
private async Task CreateChannel() { var dialog = new InputDialog($"{CurrentDictionary["ChannelName"]}", 12); var result = await DialogHost.Show(dialog); if (bool.Parse(result.ToString())) { var data = new { ChannelName = dialog.Result }; SocketClient.SendMessage(new Tlv(SocketMessageTypes.CreateChannel, data)); } }
private void SendMessage(DataBase data, Action <DataBase> ac) { try { sendDic[data.cmd] = ac; Socket.SendMessage(data); } catch (Exception e) { Debug.LogError(e.Message); } }
//Messaging //Message private void ButtonMessage_Click(object sender, RoutedEventArgs e) { try { string message = new TextRange(RichTextBoxMessage.Document.ContentStart, RichTextBoxMessage.Document.ContentEnd).Text; _client.SendMessage(message, false); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void SendMessage(DataModel item) { Console.WriteLine("SendMessage"); if (item.client == null) { client.SendMessage(item.buffer); } else { server.SendMessage(item.client, item.buffer); } }
private void BtnMessage_Click(object sender, EventArgs e) { try { var msg = rtMessage.Text; _client.SendMessage(msg, false); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
static void DoSockets() { RECEIVEORDERGATEWAY orderGateway = new RECEIVEORDERGATEWAY(); ConnectMessageModel connectModel = new ConnectMessageModel(); var manager = new MessageManager(); SocketClient socketClient = new SocketClient("membersim.bseindia.com", 8082, manager, new TcpReceiver()); socketClient.SendMessage(orderGateway); socketClient.SendMessage(connectModel); GetMarketByPriceModel getMarketByPriceModel = new GetMarketByPriceModel(); socketClient.SendMessage(getMarketByPriceModel); /* var markets = GetMarkets(); * foreach(var market in markets) * { * socketClient.SendMessage(market); * } * Thread.Sleep(10000); * var marketss = manager.marketUpdates; * foreach (var m in marketss) Debug.WriteLine(m.ToString());*/ /*GetMarketByPriceModel marketByPrice = new GetMarketByPriceModel(); * marketByPrice.LoginId = 97; * marketByPrice.SessionKey = newOrder.SessionKey; * marketByPrice.KeyIdentifier = newOrder.OEToken + "^" + newOrder.OEBSEToken + "^" + newOrder.OEMarket; * socketClient.SendMessage(marketByPrice); */ /*OrderAndTrade.AddOrder newOrder = new OrderAndTrade.AddOrder(); * AddArbitrageMarketWatchTokensModel arbitrage = new AddArbitrageMarketWatchTokensModel(); * arbitrage.LoginId = 97; * arbitrage.SessionKey = newOrder.SessionKey; * arbitrage.KeyIdentityFier = newOrder.OEToken + "^" + newOrder.OEBSEToken + "^" + newOrder.OEMarket; * socketClient.SendMessage(arbitrage);*/ //Client("Open Market by price=" + marketByPrice.OpenMarketByPrice + "|Internal USID=" + marketByPrice.LoginId + "|SessionKey=" + marketByPrice.SessionKey + "|KeyIdentifier=" + marketByPrice.KeyIdentifier); // Client(marketByPrice.OpenMarketByPrice + "|" + marketByPrice.LoginId + "|" + marketByPrice.SessionKey + "|" + marketByPrice.KeyIdentifier); }
private void btnSend_Click(object sender, RoutedEventArgs e) { if (this.txtMSG.Text == "FindAll_Product") { _client.SendRequest(new BaseRequest() { UID = "Server", Message = "FindAll_Product", MessageCommand = MessageFunction.FindAll, MessageType = MessageEntityType.JSON }); } else { _client.SendMessage(this.txtMSG.Text); } }
void Window1(int id) { scrollPosition = GUI.BeginScrollView(new Rect(5, 5, m_MessagePanelRect.width - 5, m_MessagePanelRect.height - 40), scrollPosition, new Rect(0, 0, m_MessagePanelRect.width - 100, SocketClient.m_MessageList.Count * 40)); for (int i = 0; i < SocketClient.m_MessageList.Count; i++) { GUI.Label(new Rect(5, i * 30, m_MessagePanelRect.width - 50, 40), SocketClient.m_MessageList[i].ToString()); } GUI.EndScrollView(); content = GUI.TextField(new Rect(5, m_MessagePanelRect.height - 35, m_MessagePanelRect.width - 110, 30), content); if (GUI.Button(new Rect(m_MessagePanelRect.width - 105, m_MessagePanelRect.height - 35, 100, 30), "Send")) { client.SendMessage(content); content = ""; } }
public void SendMessage(int msgId, byte[] datas) { // // 重发队列有 // if (retryQueue.Count > 0) // return; SocketClient client = GetSocketClient(); if (client == null || datas == null) { return; } // RequestMessage reqMsg = new RequestMessage(msgId, client.Identiy, datas); // requestQueue.Enqueue(reqMsg); client.SendMessage(msgId, datas); }
static int SendMessage(IntPtr L) { try { ToLua.CheckArgsCount(L, 5); SocketClient obj = (SocketClient)ToLua.CheckObject <SocketClient>(L, 1); byte arg0 = (byte)LuaDLL.luaL_checknumber(L, 2); byte arg1 = (byte)LuaDLL.luaL_checknumber(L, 3); uint arg2 = (uint)LuaDLL.luaL_checknumber(L, 4); byte[] arg3 = ToLua.CheckByteBuffer(L, 5); obj.SendMessage(arg0, arg1, arg2, arg3); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }