public socketTestPage() { InitializeComponent(); if (isServer) { server = new ServerSocketBasement(); server.Start(); connectBtn.Enabled = false; requestBtn.Enabled = false; requestIDTextBox.Enabled = false; requestIDTextBox.Text = "Server mode"; Product pro = new Product(); pro.productType = "变频器"; pro.productClass = "GD10-0R2G-S2-B"; pro.setMNo("I01161002599"); Money cny = new Money(10.0); User usr = new User(); usr.userName = "******"; usr.userPass = "******"; usr.m_userType = userType.USER_SUPERADMIN; Store store = serverMainHandler.GetSingleton().GetStore(); ImportToStore tmp = new ImportToStore(); tmp.product = pro; tmp.cost = cny; tmp.user = usr; tmp.store = store; string req = tmp.GenerateObjectClient(); string res1 = tmp.GetObjectServer(req); string res2 = tmp.GetObjectServer(req); string res3 = tmp.GetObjectServer(req); string res4 = tmp.GetObjectServer(req); MessageBox.Show("Request: \n" + req + "\n\nResponse1:\n" + res1 + "\n\nResponse2:\n" + res2 + "\n\nResponse3:\n" + res3 + "\n\nResponse4:\n" + res4); } else { client = new ClientSocketBasement(); usr = new User(); usr.userName = "******"; usr.userPass = "******"; usr.m_userType = userType.USER_SUPERADMIN; tmp2 = new ViewStoreProduct(); tmp2.user = usr; } }
public ServerPage(string ipAddr) { InitializeComponent(); ServerSocketBasement.ipAddr = ipAddr; server = new ServerSocketBasement(); server.page = this; server.Start(); testProcess(); }