vb.net - Hot to use more socket? -
i have form called frmmsg. following warning when open new frmmsg :
only 1 usage of each socket address (protocol/network address/port) permitted.
how can open form using more socket?
this code i'm using:
imports system.io imports system.threading imports system.net.sockets public class frmmsg dim listener new tcplistener(8000) dim client tcpclient dim message string private sub frmmsg_load(sender object, e eventargs) handles mybase.load dim thread new thread(new threadstart(addressof listening)) listener.start() end sub private sub listening() listener.start() end sub private sub btnnewform_click(sender object, e eventargs) handles btnnewform.click dim fnew new frmmsg fnew.show() end sub end class
where problem , how can solve it?
as apparent message can open 1 listening socket per port (in general).
therefore, must ensure there 1 instance of tcplistener(8000)
@ same time. if want have multiple forms open @ same time need reference object not form instances. maybe use static/shared variable.
Comments
Post a Comment