Re: TcpClient work on emulator but fail in real PocketPC

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Socket programming was working as suggested as I tried a sample code from the
sample code section - Signature Caputure which was using socket instate of
TcpListen and TcpClient. Basically my coding doesn't show any error by the
complier. Just that when I deployed it to the hardware, the application
doesn't seem to work; but it's working 100% perfectly using the emulator.


"Paul G. Tobey [eMVP]" wrote:

> Maybe just recoding the connection in a test program would be a better use
> of your time. Maybe you want to use TcpClient in the real program. We're
> just trying to figure out what's wrong, at this point.
>
> Paul T.
>
> "James OSW" <JamesOSW@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:2D67EBDD-BE36-40F6-92DE-E34C722323C1@xxxxxxxxxxxxxxxx
> > Basically I had tried a few models of pocket PCs' and I still experince
> > the
> > same problem. I'm currently trying to recode my whole application by using
> > socket.
> >
> >
> > "Alex Yakhnin" wrote:
> >
> >> Also, you can install the excellent tools "vxUtil - is a suite of
> >> network/internet utilities" and try ping the ip address.
> >>
> >> http://www.cam.com/vxutil_pers.html
> >>
> >> -Alex
> >>
> >> --
> >> Alex Yakhnin, .NET CF MVP
> >> www.intelliprog.com
> >> www.opennetcf.org
> >>
> >> "Paul G. Tobey [eMVP]" <ptobey no spam AT no instrument no spam DOT com>
> >> wrote in message news:efhzlv$hFHA.2472@xxxxxxxxxxxxxxxxxxxxxxx
> >> > Try using regular sockets, not TcpClients and bind to the IP address of
> >> > the WiFi adapter. It's possible that a bug (or, at least, I'd call it
> >> > bug), could try to send your traffic over a connection which doesn't
> >> > current exist (ActiveSync, cellular, etc.)
> >> >
> >> > In case this is a bug, we also need the detailed version information
> >> > for
> >> > the device: OS version/WM version, any other version information
> >> > supplied
> >> > by the Control Panel, etc.
> >> >
> >> > Paul T.
> >> >
> >> > "James OSW" <JamesOSW@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> >> > news:2C455E43-E986-40FE-AC16-783CE301382B@xxxxxxxxxxxxxxxx
> >> >>I was using the IP but not hostname. I had also actually tried both TCP
> >> >>and
> >> >> UDP method. I'll include some part of the coding for better
> >> >> understanding
> >> >> of
> >> >> the situation.
> >> >>
> >> >> Client Side
> >> >>
> >> >> 'Send Message to specific Ip and Port (first send buffer lenght and
> >> >> then
> >> >> the
> >> >> buffer holding message)
> >> >> Public Sub SendMessage(ByVal Ip As String, ByVal Port As Integer,
> >> >> ByVal
> >> >> Message As String)
> >> >> Dim tempclient As System.Net.Sockets.TcpClient
> >> >> Dim Buffer() As Byte =
> >> >> System.Text.Encoding.Default.GetBytes(Message.ToCharArray)
> >> >> If Not checkip(Ip) Then Throw New ArgumentException("Ip is not
> >> >> in
> >> >> the right format")
> >> >> Try
> >> >> tempclient = New System.Net.Sockets.TcpClient
> >> >> tempclient.Connect(Ip, Port)
> >> >> sendBufferLenght(Buffer.Length, tempclient)
> >> >> tempclient.GetStream.Write(Buffer, 0, Buffer.Length)
> >> >> tempclient.Close()
> >> >> Catch
> >> >> tempclient.Close()
> >> >> Throw New Exception("Remote IP is not reachable")
> >> >> End Try
> >> >> End Sub
> >> >>
> >> >> 'Check ip string to be an ip address
> >> >> Private Function checkip(ByVal ip As String) As Boolean
> >> >> Try
> >> >> IPAddress.Parse(ip)
> >> >> Return True
> >> >> Catch ex As Exception
> >> >> Return False
> >> >> End Try
> >> >> End Function
> >> >> End Class
> >> >>
> >> >> 'Send Information
> >> >> Try
> >> >> Client.SendMessage(IP, 6666, Combine)
> >> >> Catch ex As Exception
> >> >> MessageBox.Show(ex.Message, "Error sending message")
> >> >> End Try
> >> >> ==================================================
> >> >>
> >> >> Server Side
> >> >>
> >> >> If (Server Is Nothing) Then
> >> >> 'Retrieve(PORT)
> >> >> Dim PORT As Integer
> >> >> Server = Nothing
> >> >> Server = New AppSignalDetection.ServerClass(6666, True)
> >> >> End If
> >> >>
> >> >> Private Sub OnIncomingMessage(ByVal Args As
> >> >> AppSignalDetection.ServerClass.InMessEvArgs) Handles
> >> >> Server.IncomingMessage
> >> >> 'Get Information
> >> >> msgbox(args.message)
> >> >> End Sub
> >> >> ==================================================
> >> >>
> >> >> Communication between emulator and another seperate PC or locally are
> >> >> working but not with the real device. I was wondering does the
> >> >> application
> >> >> required additional libraries or external components for real
> >> >> hardware?
> >> >>
> >> >> Thanks.
> >> >
> >> >
> >>
> >>
> >>
>
>
>
.



Relevant Pages

  • DataAvailable property in TCPClient class misleading in usage
    ... It appears that the DataAvailable property of the TCPClient is just a test ... socket to the server is still open. ... The sample code in MSDN has a loop testing on DataAvailable, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: WSASend()
    ... There's a glaring error in the sample code - the socket is not ... overlapped I/O is so you can service multiple sockets efficiently. ... > data to the client until the client disconnects. ...
    (microsoft.public.win32.programmer.networks)
  • Re: bad sample code?
    ... Behalf Of Chuck Arney ... Subject: bad sample code? ... If RETCODE is negative there was an error on the call and there is ... no socket returned. ...
    (bit.listserv.ibm-main)
  • Re: TcpClient work on emulator but fail in real PocketPC
    ... and is based on Socket not on TcpClient. ... Have you tried my suggestion for ... > Socket programming was working as suggested as I tried a sample code from ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: WSASend()
    ... > There's a glaring error in the sample code - the socket is not ... particularly partial to "Network Programming for Microsoft Windows" by Jones ... > overlapped I/O is so you can service multiple sockets efficiently. ...
    (microsoft.public.win32.programmer.networks)