Click here to Skip to main content
15,909,822 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to play at the same time 2 or more sounds Pin
Hesham Yassin9-Jul-07 22:38
Hesham Yassin9-Jul-07 22:38 
Questionhow to sort datagridview ? (a numeric field) Pin
cmpeng349-Jul-07 4:53
cmpeng349-Jul-07 4:53 
AnswerRe: how to sort datagridview ? (a numeric field) Pin
velkropie9-Jul-07 6:24
velkropie9-Jul-07 6:24 
AnswerRe: how to sort datagridview ? (a numeric field) Pin
Luc Pattyn9-Jul-07 7:12
sitebuilderLuc Pattyn9-Jul-07 7:12 
QuestionHow do I Marshal Vector using Pinvoke Pin
Subodh Borker9-Jul-07 4:41
Subodh Borker9-Jul-07 4:41 
QuestionCrystal Reports Gurus - need help - please Pin
Rome'9-Jul-07 4:27
Rome'9-Jul-07 4:27 
QuestionUdp client Programming Pin
ramdil9-Jul-07 3:57
ramdil9-Jul-07 3:57 
AnswerRe: Udp client Programming Pin
Jimmanuel9-Jul-07 4:18
Jimmanuel9-Jul-07 4:18 
I had a similar situation not too long ago. To solve the problem I used the following snippet in a separate thread; to close the port just set UDPrunning to false, wait for the thread to exit and then you can close the port. I'm not sure if it's the best solution, but it is a solution that worked in my situation.

while (UDPrunning == true)
{
    if (udpSocket.Available > 0)
    {
        try
        {
            IPEndPoint msgSenderInfo = new IPEndPoint(IPAddress.Any, 0);
            Byte[] incomingData = udpSocket.Receive(ref msgSenderInfo);
            // do something with the data
        }
        catch (SocketException e)
        {
            // do something to handle the exception
        }
    }
    else
    {
        // Stop the thread from using too much processor time
        Thread.Sleep(100);
    }
}



GeneralRe: Udp client Programming Pin
ramdil9-Jul-07 4:41
ramdil9-Jul-07 4:41 
GeneralRe: Udp client Programming Pin
Jimmanuel9-Jul-07 4:52
Jimmanuel9-Jul-07 4:52 
GeneralRe: Udp client Programming Pin
Luc Pattyn9-Jul-07 5:05
sitebuilderLuc Pattyn9-Jul-07 5:05 
GeneralRe: Udp client Programming Pin
ramdil9-Jul-07 5:12
ramdil9-Jul-07 5:12 
GeneralRe: Udp client Programming Pin
Jimmanuel9-Jul-07 5:20
Jimmanuel9-Jul-07 5:20 
GeneralRe: Disconnecting your Ethernet may keep your app alive ! Pin
Luc Pattyn9-Jul-07 5:56
sitebuilderLuc Pattyn9-Jul-07 5:56 
GeneralRe: Disconnecting your Ethernet may keep your app alive ! Pin
Jimmanuel9-Jul-07 6:34
Jimmanuel9-Jul-07 6:34 
GeneralRe: Udp client Programming Pin
ramdil9-Jul-07 5:14
ramdil9-Jul-07 5:14 
GeneralRe: Udp client Programming Pin
Jimmanuel9-Jul-07 5:23
Jimmanuel9-Jul-07 5:23 
GeneralRe: Udp client Programming Pin
ramdil9-Jul-07 5:38
ramdil9-Jul-07 5:38 
GeneralRe: Udp client Programming Pin
Luc Pattyn9-Jul-07 5:56
sitebuilderLuc Pattyn9-Jul-07 5:56 
GeneralRe: Udp client Programming Pin
ramdil9-Jul-07 22:02
ramdil9-Jul-07 22:02 
GeneralRe: Udp client Programming Pin
Jimmanuel9-Jul-07 6:36
Jimmanuel9-Jul-07 6:36 
QuestionColoring Specific ComboBox Entries Pin
PhilDanger9-Jul-07 3:40
PhilDanger9-Jul-07 3:40 
AnswerRe: Coloring Specific ComboBox Entries Pin
Vasudevan Deepak Kumar9-Jul-07 3:45
Vasudevan Deepak Kumar9-Jul-07 3:45 
GeneralRe: Coloring Specific ComboBox Entries Pin
PhilDanger9-Jul-07 3:52
PhilDanger9-Jul-07 3:52 
AnswerRe: Coloring Specific ComboBox Entries Pin
Luc Pattyn9-Jul-07 3:56
sitebuilderLuc Pattyn9-Jul-07 3:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.