我开发了一个应用程序,在开发时遇到了一个问题。所以我想解决它。我正在使用 TCP 服务器和客户端概念。我写代码很好。但是阻止我的 WPF 窗口。我该如何解决?谁能帮我。
我的代码
private void LoadingInboxMessage(){
try {
InboxTCPServer("127.0.0.1",1001);
string []header = new string[]{"Name","Mobile","Address"};
SQL sql = new SQL();
MySqlConnection con = sql.ConnectServer("127.0.0.1","root","''","smsdb");
if(con!=null) {
MySqlDataReader dr = sql.SQLFetching(con,"SELECT * FROM receivedetails");
CreateFlowDocument cfd = new CreateFlowDocument("inboxFlow");
this.InboxFlowDocument.Document = cfd.CreateTable("inboxtable",header,dr);
}
else {
MessageBox.Show("Not Connectioned");
Application.Current.Shutdown(0);
}
} catch(Exception e) {
MessageBox.Show(e.Message);
}
}
public void InboxTCPServer(string ipv4, int port){
try {
IPAddress ip = IPAddress.Parse(ipv4);
TcpListener serv = new TcpListener(ip,port);
serv.Start();
Socket s = serv.AcceptSocket();
byte[] b = new byte[1000];
int k = s.Receive(b);
MessageBox.Show(b.ToString());
} catch(Exception e) {
MessageBox.Show(e.Message);
}
}
请帮我”