Click here to Skip to main content
15,905,912 members
Home / Discussions / C#
   

C#

 
RantRe: merge two images in a single picturebox Pin
Smithers-Jones22-Dec-08 2:38
Smithers-Jones22-Dec-08 2:38 
AnswerRe: merge two images in a single picturebox Pin
Dave Kreskowiak22-Dec-08 4:25
mveDave Kreskowiak22-Dec-08 4:25 
QuestionHow to set the Pagesettings in Reportviwer Pin
Exelioindia22-Dec-08 0:25
Exelioindia22-Dec-08 0:25 
Answersample code Pin
jaraldumary22-Dec-08 0:47
jaraldumary22-Dec-08 0:47 
AnswerRe: How to set the Pagesettings in Reportviwer Pin
Tom Deketelaere22-Dec-08 1:19
professionalTom Deketelaere22-Dec-08 1:19 
GeneralRe: How to set the Pagesettings in Reportviwer Pin
Exelioindia22-Dec-08 1:53
Exelioindia22-Dec-08 1:53 
GeneralRe: How to set the Pagesettings in Reportviwer Pin
Tom Deketelaere22-Dec-08 2:43
professionalTom Deketelaere22-Dec-08 2:43 
QuestionSocket Connections Pin
Rick van Woudenberg22-Dec-08 0:02
Rick van Woudenberg22-Dec-08 0:02 
Dear all,

I'm trying to get my computer to listen on a port and pass on the received data ( after some modification ) over Multicast. I'm receiving data on the socket every second. I wrote the code below and it works perfect.

The problem that I require some assistance with is pretty simply. Everytime a string of data is received, the socket is closed and new socket is opened to wait for the next string. When the next string of data comes in, it gets processed and the socket is closed again. This means that after a period of time, lots of socket connections are made. One of them is active and the others are in a TIME_WAIT state ( and that list keeps growing ) Is there a way around this ?


Int32 port = 31008;

                IPAddress localAddr = IPAddress.Any;
                server = new TcpListener(localAddr, port);
                server.Start();

                // Buffer for reading data
                Byte[] bytes = new Byte[256];
                String data = null;

                while (true)
                {
                    client = server.AcceptTcpClient();
                    data = null;
                    NetworkStream stream = client.GetStream();

                    int i;

                    while ((i = stream.Read(bytes, 0, bytes.Length)) != 0)
                    {
                        data = System.Text.Encoding.ASCII.GetString(bytes, 0, i);
                        data = data.ToUpper();
                        byte[] msg = System.Text.Encoding.ASCII.GetBytes(data);
                        
                        SendMulticast(MultiCastIP, MultiCastPort, msg);
                    }
                    client.Close();
                }



kind regards,

Rick
AnswerRe: Socket Connections Pin
Mark Salsbery22-Dec-08 7:52
Mark Salsbery22-Dec-08 7:52 
QuestionRuntime Report Formating.... Pin
zeeShan anSari21-Dec-08 23:40
zeeShan anSari21-Dec-08 23:40 
QuestionMark field in child class as NonSerialized Pin
Dust Signs21-Dec-08 23:34
Dust Signs21-Dec-08 23:34 
AnswerRe: Mark field in child class as NonSerialized Pin
deyaert21-Dec-08 23:42
deyaert21-Dec-08 23:42 
GeneralRe: Mark field in child class as NonSerialized Pin
Dust Signs21-Dec-08 23:51
Dust Signs21-Dec-08 23:51 
GeneralRe: Mark field in child class as NonSerialized Pin
deyaert22-Dec-08 0:31
deyaert22-Dec-08 0:31 
GeneralRe: Mark field in child class as NonSerialized Pin
Dust Signs22-Dec-08 0:39
Dust Signs22-Dec-08 0:39 
GeneralRe: Mark field in child class as NonSerialized Pin
deyaert22-Dec-08 0:58
deyaert22-Dec-08 0:58 
GeneralRe: Mark field in child class as NonSerialized Pin
Dust Signs22-Dec-08 1:01
Dust Signs22-Dec-08 1:01 
GeneralRe: Mark field in child class as NonSerialized Pin
deyaert22-Dec-08 1:02
deyaert22-Dec-08 1:02 
QuestionHow can I update rows in a table using OLEDB in C#? Pin
dliviu21-Dec-08 22:39
dliviu21-Dec-08 22:39 
AnswerRe: How can I update rows in a table using OLEDB in C#? Pin
Christian Graus21-Dec-08 22:45
protectorChristian Graus21-Dec-08 22:45 
GeneralRe: How can I update rows in a table using OLEDB in C#? Pin
dliviu21-Dec-08 22:55
dliviu21-Dec-08 22:55 
GeneralRe: How can I update rows in a table using OLEDB in C#? Pin
Christian Graus21-Dec-08 23:04
protectorChristian Graus21-Dec-08 23:04 
QuestionException of file encryption using c# Pin
cat ang21-Dec-08 21:04
cat ang21-Dec-08 21:04 
AnswerRe: Exception of file encryption using c# Pin
Christian Graus21-Dec-08 22:42
protectorChristian Graus21-Dec-08 22:42 
GeneralRe: Exception of file encryption using c# Pin
cat ang22-Dec-08 2:16
cat ang22-Dec-08 2:16 

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.