public void BeginCmd(string sCmd, SocketLineHandler lh) { if (bInUse) { new Exception("IQFeedPort " + portnumber.ToString() + " is in use with '" + sCmd + "'"); } else { this.lh = lh; bInUse = true; iqfport = this; this.sCmd = sCmd; //Monitor.Enter(qPortCmds); lock (qPortCmds.SyncRoot) { if (0 == qPortCmds.Count) { //Console.WriteLine("BeginCmd creating new socket"); bs = new BufferedSocket("127.0.0.1", portnumber, lh); bs.Open(); } else { //Console.WriteLine("BeginCmd regurgitating socket"); bs = qPortCmds.Dequeue() as BufferedSocket; bs.Add(lh); } } //Monitor.Exit(qPortCmds); bs.Send(sCmd); } }
public void Close() { buffer.Close(); buffer = null; slh = null; sock.Shutdown(SocketShutdown.Both); sock.Close(); sock = null; }
public void Remove(SocketLineHandler slh) { this.HandleSocketLine -= slh; }
public void Add(SocketLineHandler slh) { this.HandleSocketLine += slh; }
public void Remove(SocketLineHandler slh) { buffer.Remove(slh); }
public void Add(SocketLineHandler slh) { buffer.Add(slh); }
public BufferedSocket(string Host, int Port, SocketLineHandler slh) { this.Host = Host; this.Port = Port; this.slh = slh; }