public virtual void Draw() { _nodeView.Draw(); Port.Draw(_nodeView.Rect); PortOut.Draw(_nodeView.Rect); UpdateNodeData(); }
/* * Open the sockets and make the connection */ public override int Open() { int Result = 0; RemoteIP = Server; RemotePort = PortOut.ToString(); LocalPort = PortIn.ToString(); try { sck.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); LocalIP = GetLocalIP(); } catch (Exception ex) { AddError(Result = 801, ex.Message, GetType().Name + ".SocketClient", "Failed to set socket"); } try { // binding socket epLocal = new IPEndPoint(IPAddress.Parse(LocalIP), Convert.ToInt32(LocalPort)); sck.Bind(epLocal); // connect to remote IP and port epRemote = new IPEndPoint(IPAddress.Parse(RemoteIP), Convert.ToInt32(RemotePort)); sck.Connect(epRemote); Connected = true; if (DebugLevel > 5) { WriteDebug("Waiting..."); } // starts to listen to an specific port buffer = new byte[1500]; sck.BeginReceiveFrom(buffer, 0, buffer.Length, SocketFlags.None, ref epRemote, new AsyncCallback(MessageCallBack), buffer); } catch (Exception ex) { AddError(Result = 802, ex.Message, GetType().Name + ".SocketClient", "Failed to open socket"); } return(Result); }
public void GetNotesWithDefaultClientTest() { using (var server = new HttpServer(new RequestHandler { EstimatedMethod = "GET", EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/portouts/1/notes", Helper.AccountId), ContentToSend = new StringContent(TestXmlStrings.NotesResponse, Encoding.UTF8, "application/xml") })) { var list = PortOut.GetNotes("1").Result; if (server.Error != null) { throw server.Error; } Assert.AreEqual(2, list.Length); Assert.AreEqual("11299", list[0].Id); Assert.AreEqual("customer", list[0].UserId); Assert.AreEqual("Test", list[0].Description); Assert.AreEqual("11301", list[1].Id); Assert.AreEqual("customer", list[1].UserId); Assert.AreEqual("Test1", list[1].Description); } }
public void AddNoteTest() { var item = new Note { UserId = "customer", Description = "Test" }; using (var server = new HttpServer(new[] { new RequestHandler { EstimatedMethod = "POST", EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/portouts/1/notes", Helper.AccountId), EstimatedContent = Helper.ToXmlString(item), HeadersToSend = new Dictionary <string, string> { { "Location", string.Format("/v1.0/accounts/{0}/portins/1/portouts/11299", Helper.AccountId) } } }, new RequestHandler { EstimatedMethod = "GET", EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/portouts/1/notes", Helper.AccountId), ContentToSend = new StringContent(TestXmlStrings.NotesResponse, Encoding.UTF8, "application/xml") } })) { var client = Helper.CreateClient(); var r = PortOut.AddNote(client, "1", item).Result; if (server.Error != null) { throw server.Error; } Assert.AreEqual("11299", r.Id); Assert.AreEqual("customer", r.UserId); Assert.AreEqual("Test", r.Description); } }
public void ProcessEvents(Event e) { _nodeView.ProcessEvents(e); Port.ProcessEvents(e); PortOut.ProcessEvents(e); }