C# window app to listen multiple port simultaneously..
-
Hi!! Hello every one... I wanted to know what should i do to keep on listening to multiple ports for msgs and displaying on respective text boxes. i've tried asych sockets. but cant get it right.. it listens for only one time. if i start a while loop the whole app stops responding.. i hope threading is a answer but i know nothing abt it.. plz guide me..
-
Hi!! Hello every one... I wanted to know what should i do to keep on listening to multiple ports for msgs and displaying on respective text boxes. i've tried asych sockets. but cant get it right.. it listens for only one time. if i start a while loop the whole app stops responding.. i hope threading is a answer but i know nothing abt it.. plz guide me..
Hi, 1. the question is unclear. What ports? TCP/IP ports? SerialPort instances? ... 2. regardless, you can handle that with either asynchronous methods and events, or by having some kind of thread and a blocking read. 3. in any case, you can't touch GUI Controls from threads other than the main thread. So don't try
myTextBox.Text="got something";
inside a DataReceived handler. The solution is here[^]. :)Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
-
Hi, 1. the question is unclear. What ports? TCP/IP ports? SerialPort instances? ... 2. regardless, you can handle that with either asynchronous methods and events, or by having some kind of thread and a blocking read. 3. in any case, you can't touch GUI Controls from threads other than the main thread. So don't try
myTextBox.Text="got something";
inside a DataReceived handler. The solution is here[^]. :)Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
Ans 1. TCP/IP Ports... Ans 2. How can i use Threading in GUI app??? i've textbox1 and textbox2. now i need to listen port port1 and port2 and direct the received msgs to their respective textboxes. Ans 3. thanks for that.. i've studied it already.. that cross thread funcs..
-
Ans 1. TCP/IP Ports... Ans 2. How can i use Threading in GUI app??? i've textbox1 and textbox2. now i need to listen port port1 and port2 and direct the received msgs to their respective textboxes. Ans 3. thanks for that.. i've studied it already.. that cross thread funcs..
ayandelhi wrote:
How can i use Threading in GUI app???
threading is the same in all kinds of apps, whether GUI, Console, or headless. However to access Controls you need to Invoke. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at them.
-
ayandelhi wrote:
How can i use Threading in GUI app???
threading is the same in all kinds of apps, whether GUI, Console, or headless. However to access Controls you need to Invoke. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at them.
I'm lost in it.. i cant see thru it.. when i type a msg in msg text box i shud start a thread which sends it to client n then waits until a msg is received from client. Right.. or something else.. One more thing... how much time does it take a msg to get delivered from client to server on a lan of max 10 pcs.. i'm asking this coz i want active feed from my clients.. wheneva they type anything on their app it shud be displayed on my window...
-
I'm lost in it.. i cant see thru it.. when i type a msg in msg text box i shud start a thread which sends it to client n then waits until a msg is received from client. Right.. or something else.. One more thing... how much time does it take a msg to get delivered from client to server on a lan of max 10 pcs.. i'm asking this coz i want active feed from my clients.. wheneva they type anything on their app it shud be displayed on my window...
ayandelhi wrote:
I'm lost in it.. i cant see thru it.. when i type a msg in msg text box i shud start a thread which sends it to client n then waits until a msg is received from client. Right.. or something else..
I don't see a specific question here. if you are not familiar with the subject, read up on it, think about it, and experiment. when stuck, ask a specific question.
ayandelhi wrote:
how much time does it take
42 msec. how long is your message? how fast is your LAN? what other traffic is there? how inefficient is your code? if you now some app that does things similar to what you want, then that proves it can be done; if not, it may be an indication it can't be done. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at them.
-
ayandelhi wrote:
I'm lost in it.. i cant see thru it.. when i type a msg in msg text box i shud start a thread which sends it to client n then waits until a msg is received from client. Right.. or something else..
I don't see a specific question here. if you are not familiar with the subject, read up on it, think about it, and experiment. when stuck, ask a specific question.
ayandelhi wrote:
how much time does it take
42 msec. how long is your message? how fast is your LAN? what other traffic is there? how inefficient is your code? if you now some app that does things similar to what you want, then that proves it can be done; if not, it may be an indication it can't be done. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at them.
actually... m running both client n server on my pc.. n m typin on client and it shud be visible as it is.. m sending the text to a file too and to server too.. on file i've complete text but m not getting on the server side.. i want a live feed of wat is the user typing on client not the file.. help me out..
-
ayandelhi wrote:
I'm lost in it.. i cant see thru it.. when i type a msg in msg text box i shud start a thread which sends it to client n then waits until a msg is received from client. Right.. or something else..
I don't see a specific question here. if you are not familiar with the subject, read up on it, think about it, and experiment. when stuck, ask a specific question.
ayandelhi wrote:
how much time does it take
42 msec. how long is your message? how fast is your LAN? what other traffic is there? how inefficient is your code? if you now some app that does things similar to what you want, then that proves it can be done; if not, it may be an indication it can't be done. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at them.
Luc Pattyn wrote:
42 msec
:thumbsup:
Dave
Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum. Astonish us. Be exceptional. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)