internal static int LoadNew(IntPtr proc, int parIndex, int err, out HSocket[] obj) { HTuple tuple; err = HTuple.LoadNew(proc, parIndex, err, out tuple); obj = new HSocket[tuple.Length]; for (int index = 0; index < tuple.Length; ++index) { obj[index] = new HSocket(tuple[index].IP); } return(err); }
/// <summary> /// Send a serialized item over a socket connection. /// Instance represents: Handle of the serialized item. /// </summary> /// <param name="socket">Socket number.</param> public void SendSerializedItem(HSocket socket) { IntPtr proc = HalconAPI.PreCall(404); this.Store(proc, 1); HalconAPI.Store(proc, 0, (HTool)socket); int procResult = HalconAPI.CallProcedure(proc); HalconAPI.PostCall(proc, procResult); GC.KeepAlive((object)this); GC.KeepAlive((object)socket); }
/// <summary> /// Receive a serialized item over a socket connection. /// Modified instance represents: Handle of the serialized item. /// </summary> /// <param name="socket">Socket number.</param> public void ReceiveSerializedItem(HSocket socket) { this.Dispose(); IntPtr proc = HalconAPI.PreCall(403); HalconAPI.Store(proc, 0, (HTool)socket); HalconAPI.InitOCT(proc, 0); int err = HalconAPI.CallProcedure(proc); int procResult = this.Load(proc, 0, err); HalconAPI.PostCall(proc, procResult); GC.KeepAlive((object)this); GC.KeepAlive((object)socket); }
/// <summary> /// Accept a connection request on a listening socket of the protocol type 'HALCON' or 'TCP'/'TCP4'/'TCP6'. /// Instance represents: Socket number of the accepting socket. /// </summary> /// <param name="wait">Should the operator wait until a connection request arrives? Default: "auto"</param> /// <returns>Socket number.</returns> public HSocket SocketAcceptConnect(string wait) { IntPtr proc = HalconAPI.PreCall(341); this.Store(proc, 0); HalconAPI.StoreS(proc, 1, wait); HalconAPI.InitOCT(proc, 0); int err = HalconAPI.CallProcedure(proc); HSocket hsocket; int procResult = HSocket.LoadNew(proc, 0, err, out hsocket); HalconAPI.PostCall(proc, procResult); GC.KeepAlive((object)this); return(hsocket); }
internal static int LoadNew(IntPtr proc, int parIndex, int err, out HSocket obj) { obj = new HSocket(HTool.UNDEF); return(obj.Load(proc, parIndex, err)); }