Results 1 to 2 of 2

Thread: mobile based application connect to PC!!!

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2005
    Posts
    840

    Question mobile based application connect to PC!!!

    i'm writing a chatting application for PDA, below is my code for establish connection to computer(the ip address is the router ip address)........but i still new for mobile programming....now i ask for some opinion whether it will work in PDA or not?

    VB Code:
    1. Const mBufferSize As Integer = 255
    2.     Private mBuffer(mBufferSize) As Byte
    3.     Private sendBuffer(mBufferSize) As Byte
    4.     Public Shared mSocket As Socket
    5.  
    6.     Public Sub Connect()
    7.         mSocket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
    8.         mSocket.BeginConnect(New IPEndPoint(IPAddress.Parse("192.168.0.111"), 8080), AddressOf Connected, mSocket)
    9.     End Sub
    10.  
    11.     Public Sub Connected(ByVal ar As IAsyncResult)
    12.         mSocket = DirectCast(ar.AsyncState, Socket)
    13.         mSocket.EndConnect(ar)
    14.  
    15.         MsgBox("Connected")
    16.  
    17.         mSocket.BeginReceive(mBuffer, 0, mBufferSize, SocketFlags.None, AddressOf getMessage, mSocket)
    18.  
    19. End Sub

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,109

    Re: mobile based application connect to PC!!!

    I posted a set of classes that I use to do something like that in your post in the .NET forum. There are a few differences in the socket settings, but compare the two.
    My usual boring signature: Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width