Troubleshooting Communication Errors Between the Client Application and Unwired Server

Add COMMUNICATION_ERROR_CODE code to your client applications to gather communication error details.

While the Unwired Server ml.log file logs communication errors when there are synchronization errors between Unwired Server and the client, adding COMMUNICATION_ERROR_CODE code to the client application provides more detailed information about the types of errors encountered (unable to locate host, timeout, authentication) and is useful in isolating the problem, as this code example illustrates:
     public void Sync()
	{
            try
            {
                Product.Synchronize();
                MessageBox.Show("Sync Done");
            }
            catch (SUPClientException ex)
            {
                if (ex.ErrorCode == SUPClientException.COMMUNICATION_ERROR)
                {
                    COMMUNICATION_ERROR_CODE code = ex.CommunicationErrorCode;
                    if (code == COMMUNICATION_ERROR_CODE.SOCKET_HOST_NAME_NOT_FOUND)
                    {
                        MessageBox.Show("Server not found. Check host name.");
                    }
                    else if (code == COMMUNICATION_ERROR_CODE.CONNECT_TIMEOUT)
                    {
                        MessageBox.Show("Connection timed out. Try again later.");
                    }
                    else if (code == COMMUNICATION_ERROR_CODE.AUTHENTICATION_FAILED)
                    {
                        MessageBox.Show("Authentication failed. Check credentials.");
                    }
                    else
                    {
                        MessageBox.Show(code.ToString());
                    }
                }
                else
                {
                    MessageBox.Show(ex.ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
	}


Created July 22, 2009. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com