|
Hi,
I would not like a Join in my closing code, it might sit and wait forever.
Isnt the essence of the problem that you want the UDP listener thread to be
a background thread, one that does not prevent your app from exiting ?
|
|
|
|
|
Hi
can you bit clear please as i am new this socket programming and any way i am calling the receive method in a thread...
Regards
DilipRam
|
|
|
|
|
That essentially was the idea but there are 2 reasons that I didn't set udpSocketThread.IsBackground = true; and forget about it:
1) The worker function is coded to avoid a blocking situation where the thread would hang so I wasn't worried about it waiting forever and
2) I didn't previously know about the Background vs. Foreground Thread property. That's a pretty nifty Property to have, thanks for the info!
|
|
|
|
|
Yes, but my point is when the listener is in its Receive() method, it needs
another packet to resume its course, and only after that it could exit the loop,
so your Join() is actually waiting for another UDP packet to arrive (which
may never happen).
|
|
|
|
|
In my situation I wasn't worried about the Ethernet cable being pulled. It was just a little test app connecting to a server on the local machine as a proof-of-concept of another piece of code. That's why I said in my original post "I'm not sure if it's the best solution, but it is a solution that worked in my situation."
Using IsBackground would have been a wiser choice had I known about it.
|
|
|
|
|
Thanks for the reply..
just want to confirm that the join method will not get into any hang mode.
because i am calling the stop method by creating a object of dll and i dont have a thread in my application but the thread is present in dll where i have written the recieve method...
Regards
DilipRam
|
|
|
|
|
See my reply to Lucs post. I just found this[^] article explaining background vs. foreground threads, so apparently if you set udpSocketThread.IsBackground = true; then you won't ever have to worry about Joining the thread.
|
|
|
|
|
Thanks again and sorry for troubling again.just to ensure
that instead of doing UdpListnerThread.Join(); in my stop method
i need to set udpSocketThread.IsBackground = true.is that it means
thanks
Regards
DilipRam
|
|
|
|
|
That's how I would do it anyway.
|
|
|
|
|
Thanks for replies..finally my stop method will be having the following code
since i am using two udps and thread name is
udpManagerbroadCast.Close();///..udp
UdpListnerThread.IsBackground = true;///..thread
FlagVal = true;///flag value
soUdp.Close();///..udp
and hope this is what you all were suggesting.Hope this fit the standards which you were suggesting
Regards
DilipRam
|
|
|
|
|
|
Hello everyone,
I'm searching for a solution to a relatively small design specification that has turned into a big hassle. Data is loaded into each ComboBox from an XML file on a network. In the XML file, default values are specified for each ComboBox. I need to change the background color of the choice that is specified as the default -- that is, when the default is selected, it's background should change to a light-blue color, and the color should also appear when it is dropped-down and not currently selected.
Setting the BackColor makes it so every item is colored during the drop-down, and not just the default row. I read a CP article about a super-combo-box with font coloring for specific items (with a multitude of superfluous features), but for this application that is like killing a fly with a hand-grenade.
Does anyone have any simple suggestions or recommendations for this "simple" problem?
Thanks in advance,
Phil
|
|
|
|
|
|
Hi Vasudevan,
Could you please point me towards the Windows Form equivalent -- if one exists?
Thank you,
Phil
|
|
|
|
|
Hi,
ComboBox and ListBox share some characteristics:
1.
they collect and display items that dont have to be strings; it can be any type
you choose. So you can create your own little class that holds whatever is
appropriate to represent the info for that item; then you provide a ToString()
method to deliver the display string.
2.
they support a DrawMode property; when set to one of the UserDraw values,
it is up to your program to draw each individual item (in the DrawItem event)
any way you like.
Combining both points can be very powerful !
|
|
|
|
|
Hi Luc,
Thanks a lot, this looks very promising!
-Phil
|
|
|
|
|
|
How do I wrap the text of a Toolbar button or of a Normal Button?
|
|
|
|
|
Try using the \n (newline) char in the button's caption.
/ravi
|
|
|
|
|
Hi,
most controls that have a Text property will display the text in one or more
lines. They wrap automatically if AutoSize is false, Width is insufficient,
and Height is sufficient to accomodate several lines of text.
And you can force a line break by inserting a newline ('\n') character.
|
|
|
|
|
If it is a HTML page then \n need to be replaced with <BR> tag. Isn't it?
|
|
|
|
|
I dont know, but that could be correct (unless inside a PRE block).
|
|
|
|
|
Hi,
One of my clients has exported his product list to CSV, and there are funny characters in the long description, and it is giving me errors when I try doing an import. The long description cell has little white blocks at the end of the text, almost like a new line. How would I test for something like this, and remove it?
What is it?
Regards
ma se
|
|
|
|
|
Is it unicode by some chance?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Hi,
I worked on a project which writes 2 doc files, in memory stream.
From the memory stream I wrote all the bytes to a file
something like this:
File.WriteAllBytes(path,mybytes).
The problem is that I can't see all the information.
But if I look in my file with Windows Commander the information which I can't see is there.
Where should be the problem?
Thanks for your help.
|
|
|
|