//loginclicked void btnLoginClicked(object sender, MouseEventArgs e) { TcpClient tcpClient = new TcpClient(server, 7000); NetworkStream stream = tcpClient.GetStream(); string id = tbx_ID.Text; string password = tbx_password.Text; ByteField loginmsg = new ByteField(256); string msg = id + " " + password; TcpHeader head; head.mode = 2; head.msgsize = 0; loginmsg.setHeader(head); loginmsg.ConcStrAfterHead(msg); loginmsg.setHeadLenByIndex(); stream.Write(loginmsg.m_field, 0, (int)loginmsg.getheader().msgsize); int cnt = 0; ByteField msgFromServ = new ByteField(256); cnt += stream.Read(msgFromServ.m_field, 0, 256 - cnt); while (cnt < 8) { cnt += stream.Read(msgFromServ.m_field, cnt, 256 - cnt); } if (msgFromServ.getheader().mode == 200) { // 로그인 시작 Form client = new ProfileForm(); ((ProfileForm)client).initData(tbx_ID.Text, tcpClient, msgFromServ.getMsgStr()); client.Show(); this.Hide(); } else { MessageBox.Show("아이디와비밀번호를 확인해주세요"); } }