//이미지 수신 이벤트 핸들러 void RecvImgHandler(object sender, RecvImgEventArgs e) { if (RecvedImage != null) { RecvedImage(this, e); } }
void Receive(Socket dosock) { byte[] lbuf = new byte[4]; //이미지 길이수신 버퍼 dosock.Receive(lbuf); int len = BitConverter.ToInt32(lbuf, 0); byte[] buff = new byte[len]; int trans = 0; while (trans < len) { trans += dosock.Receive(buff, trans, len - trans, SocketFlags.None);//이미지수신 } if (RecvImg != null) { //이미지 수신이벤트 IPEndPoint iep = dosock.RemoteEndPoint as IPEndPoint; RecvImgEventArgs e = new RecvImgEventArgs(iep, ConvertBitmap(buff)); RecvImg(this, e); } dosock.Close(); }
void GetInstacne_RecvedImage(object sender, RecvImgEventArgs e) { if (!chk) { Controller.Singleton.StartEventClient(); chk = true; csize = e.Image.Size; } pbx_remote.Image = e.Image; }