Click here to Skip to main content
15,922,427 members
Home / Discussions / C#
   

C#

 
AnswerRe: Show Form and Disable Button How? Pin
musefan24-Feb-09 3:41
musefan24-Feb-09 3:41 
GeneralRe: Show Form and Disable Button How? Pin
soulidentities24-Feb-09 3:56
soulidentities24-Feb-09 3:56 
GeneralRe: Show Form and Disable Button How? Pin
musefan24-Feb-09 4:26
musefan24-Feb-09 4:26 
GeneralRe: Show Form and Disable Button How? Pin
soulidentities24-Feb-09 5:58
soulidentities24-Feb-09 5:58 
AnswerRe: Show Form and Disable Button How? Pin
DaveyM6924-Feb-09 4:43
professionalDaveyM6924-Feb-09 4:43 
AnswerRe: Show Form and Disable Button How? Pin
Paul Kettley24-Feb-09 6:16
Paul Kettley24-Feb-09 6:16 
GeneralRe: Show Form and Disable Button How? Pin
soulidentities24-Feb-09 6:39
soulidentities24-Feb-09 6:39 
QuestionServer Crahes when the client is not reachable Pin
M. J. Jaya Chitra24-Feb-09 2:26
M. J. Jaya Chitra24-Feb-09 2:26 
Dear All,

I have a network application with UDP implementation.

In the server it has a specific IP and port number configured.

It will listen for the messages from the client to server and acknowledges the same.

Same way some times the server will initiate the communication and will try to send the message from the server to client.

For the messages from client to server and ACK it is working fine, even though the client or the server is restarted.

For the messages form the server to client, it tries and if the client is not reachable, it throws the error and then in the catch also I have made the server to continue to listen by calling BeginReceiveFrom, but it still throws the error.

The code used is:

private void OnReceive(IAsyncResult ar)
        {
            IPEndPoint ipeSender = new IPEndPoint(IPAddress.Any, 0);
            EndPoint epSender = (EndPoint)ipeSender;

            try
            {
                serverSocket.EndReceiveFrom(ar, ref epSender);

                //Transform the array of bytes received from the user into an
                //intelligent form of object Data
                Data msgReceived = new Data(byteData);

                ipeSender = epSender as IPEndPoint;

                // Processing the message which is received

                byte[] message = new byte[<<ACK size>>];
                // Frames the ACK

                serverSocket.BeginSendTo(message, 0, message.Length, SocketFlags.None, epSender,
                    new AsyncCallback(OnSend), epSender); // epSender holds the sender Endpoint.

                byteData = new byte[40];
                serverSocket.BeginReceiveFrom(byteData, 0, byteData.Length, SocketFlags.None, ref epServerSender,
                    new AsyncCallback(OnReceive), epServerSender); // epServerSender holds the server IP and port.
            }
            catch (Exception ex)
            {
                byteData = new byte[40];
                serverSocket.BeginReceiveFrom(byteData, 0, byteData.Length,
                    SocketFlags.None, ref epServerSender, new AsyncCallback(OnReceive), epServerSender);
                    // error is thrown in the above statement
                }
            }
        }


Can any one help me to get rid of this issue.

Thanks a lot in advance.

Best Regards,
M. J. Jaya Chitra

AnswerRe: Server Crahes when the client is not reachable Pin
PIEBALDconsult24-Feb-09 3:52
mvePIEBALDconsult24-Feb-09 3:52 
Questionchm maker article? Pin
Seraph_summer24-Feb-09 2:08
Seraph_summer24-Feb-09 2:08 
JokeRe: chm maker article? Pin
musefan24-Feb-09 3:34
musefan24-Feb-09 3:34 
GeneralRe: chm maker article? Pin
Seraph_summer24-Feb-09 4:24
Seraph_summer24-Feb-09 4:24 
JokeRe: chm maker article? Pin
musefan24-Feb-09 4:28
musefan24-Feb-09 4:28 
Question4 IT developers Pin
shefa' isied24-Feb-09 1:49
shefa' isied24-Feb-09 1:49 
AnswerRe: 4 IT developers Pin
EliottA24-Feb-09 2:00
EliottA24-Feb-09 2:00 
AnswerRe: 4 IT developers Pin
Ennis Ray Lynch, Jr.24-Feb-09 3:22
Ennis Ray Lynch, Jr.24-Feb-09 3:22 
AnswerRe: 4 IT developers Pin
PIEBALDconsult24-Feb-09 3:53
mvePIEBALDconsult24-Feb-09 3:53 
GeneralRe: 4 IT developers Pin
Ennis Ray Lynch, Jr.24-Feb-09 4:23
Ennis Ray Lynch, Jr.24-Feb-09 4:23 
GeneralRe: 4 IT developers Pin
PIEBALDconsult24-Feb-09 15:22
mvePIEBALDconsult24-Feb-09 15:22 
GeneralRe: 4 IT developers Pin
Ennis Ray Lynch, Jr.24-Feb-09 16:04
Ennis Ray Lynch, Jr.24-Feb-09 16:04 
GeneralRe: 4 IT developers Pin
Megidolaon25-Feb-09 22:19
Megidolaon25-Feb-09 22:19 
QuestionParsing nested blocks in SQL using C# [modified] Pin
aaCog24-Feb-09 1:21
aaCog24-Feb-09 1:21 
AnswerRe: Parsing nested blocks in SQL using C# Pin
Ennis Ray Lynch, Jr.24-Feb-09 3:24
Ennis Ray Lynch, Jr.24-Feb-09 3:24 
QuestionRe: Parsing nested blocks in SQL using C# Pin
aaCog24-Feb-09 17:34
aaCog24-Feb-09 17:34 
GeneralFirefox-like Download listbox Pin
see_seA24-Feb-09 0:53
see_seA24-Feb-09 0:53 

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.