Click here to Skip to main content
15,909,939 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a desktop application listening for in coming connection request, this works fine. What isn't working fine is the mobile side of things, I am trying to send a string over bluetooth to the listning server but am getting a socket exception:

Code on mobile/client (Windows Mobile 5.0 device):

private void btnPlay_Click(object sender, EventArgs e)
{
    TcpClient tcpClient = new TcpClient(Dns.GetHostName(), 2112); <<ERROR HERE?
    NetworkStream ns = tcpClient.GetStream();
    string objSent = "Play";
    
    int data = Encoding.ASCII.GetByteCount(objSent);
    while (data != -1)
    {
        ns.WriteByte((byte)data);
        data = Encoding.ASCII.GetByteCount(objSent);
    }
    ns.Close();
    tcpClient.Close();
}


Following is the error:

An error message is available for this exception but cannot be displayed because these messages are optional and are not currently installed on this device. Please install "NETCFv35.Messages.EN.wm.cab" for Windows Mobile 5.0 and above or "NETCFv35.Messages.EN.cab" for other platforms. Restart the application to see the message.
Posted
Updated 9-Sep-10 9:48am
v3
Comments
HimanshuJoshi 9-Sep-10 13:22pm    
Added code-block and reformatted code for indentation.
Added exception information from poster's reply below
Richard MacCutchan 9-Sep-10 13:24pm    
Hmm, let me guess, the exception says "..."
#realJSOP 9-Sep-10 13:25pm    
Ya know, if you supplied the exception you were seeing, you might even get some help.

Dns.GetHostName() returns you the hostname of the client not the server.
new TcpClient() will need the name of the server not the client.
If you are not doing this on the same machine, then this might be the problem.

And this is a wild guess since you have not supplied any information about the exception
 
Share this answer
 
v2
Comments
Dalek Dave 9-Sep-10 20:24pm    
Good call.
HimanshuJoshi 10-Sep-10 9:55am    
Thank you
Sorry about that, here is the message:

An error message is available for this exception but cannot be displayed because these messages are optional and are not currently installed on this device. Please install ‘NETCFv35.Messages.EN.wm.cab’ for Windows Mobile 5.0 and above or ‘NETCFv35.Messages.EN.cab’ for other platforms. Restart the application to see the message.
 
Share this answer
 
Comments
#realJSOP 9-Sep-10 15:40pm    
So did you do that?
Tichaona J 9-Sep-10 15:42pm    
Yes and still am getting the same thing...
HimanshuJoshi 9-Sep-10 15:47pm    
One suggestion, do not post additional details about the question as answer. Edit the question using improve question link below the question and add this there.
Tichaona J 9-Sep-10 15:49pm    
Will do, thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900