locked
How to Make TCP and UDP request in Windows Mobile 6.0 Application?? RRS feed

  • Question

  • Hello friends....
    I am new in Windows Mobile Development......

    I want to send data on TCP and UDP from the Mobile Application...
    How can i do this....using C#...???

    Is there any sample application is available....???

    Please reply...

    Thankxxx
    Monday, July 6, 2009 11:30 AM

Answers

  • Monday, July 6, 2009 11:42 AM
  • Hi Pranay_MobileDev,

    Please refer this example


    public static void RunSocketTcpClient()  
    
    {  
      
    Socket sock = new Socket(AddressFamily.InterNetwork,SocketType.Stream, ProtocolType.Tcp);  
     
    IPEndPoint iep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 8080);  
      
    byte[] data = new byte[1024];  
      
    string stringData;  
      
    int recv=0;  
      
    sock.Connect(iep);  
      
    data = Encoding.ASCII.GetBytes("Hello");  
      
    sock.Send(data, data.Length, SocketFlags.None);  
      
    }  

    Link



    Hope this may be help.


    Pavan Pareta | If you find my post is helpful for you then mark as a answer.
    • Proposed as answer by WmDev Monday, July 6, 2009 12:05 PM
    • Edited by WmDev Monday, July 6, 2009 12:08 PM Code Modification
    • Marked as answer by Guang-Ming Bian - MSFT Friday, July 10, 2009 2:41 AM
    Monday, July 6, 2009 12:05 PM
  • Hi Pranay,

    WM SDK provide a sample, please refer to it:
    D:\Program Files\Windows Mobile 6 SDK\Samples\Common\CPP\Win32\SockApp


    There are two application in the sample, one is client, the other is server. SocClient is a Win32 Desktop component that demontrates the use of
     sockets to communicate with a Windows Mobile device. At first hand, the application uses IRAPI interfaces to get the IP of the  Windows Mobile connected through ActiveSync.  In a second step, it sends a hello string and listen for the device to repond back.



    Best regards,
    Guang-Ming Bian - MSFT
    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Wednesday, July 8, 2009 3:19 AM
  • Hi,

    The following is also useful to know :-

    http://blogs.msdn.com/anthonywong/archive/2006/03/13/550686.aspx

    Hope this helps.

    Paul Diston
    http://www.smartmobiledevice.co.uk/
    Wednesday, July 8, 2009 7:01 AM

All replies

  • Monday, July 6, 2009 11:42 AM
  • Hi Pranay_MobileDev,

    Please refer this example


    public static void RunSocketTcpClient()  
    
    {  
      
    Socket sock = new Socket(AddressFamily.InterNetwork,SocketType.Stream, ProtocolType.Tcp);  
     
    IPEndPoint iep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 8080);  
      
    byte[] data = new byte[1024];  
      
    string stringData;  
      
    int recv=0;  
      
    sock.Connect(iep);  
      
    data = Encoding.ASCII.GetBytes("Hello");  
      
    sock.Send(data, data.Length, SocketFlags.None);  
      
    }  

    Link



    Hope this may be help.


    Pavan Pareta | If you find my post is helpful for you then mark as a answer.
    • Proposed as answer by WmDev Monday, July 6, 2009 12:05 PM
    • Edited by WmDev Monday, July 6, 2009 12:08 PM Code Modification
    • Marked as answer by Guang-Ming Bian - MSFT Friday, July 10, 2009 2:41 AM
    Monday, July 6, 2009 12:05 PM
  • Hi Pranay,

    WM SDK provide a sample, please refer to it:
    D:\Program Files\Windows Mobile 6 SDK\Samples\Common\CPP\Win32\SockApp


    There are two application in the sample, one is client, the other is server. SocClient is a Win32 Desktop component that demontrates the use of
     sockets to communicate with a Windows Mobile device. At first hand, the application uses IRAPI interfaces to get the IP of the  Windows Mobile connected through ActiveSync.  In a second step, it sends a hello string and listen for the device to repond back.



    Best regards,
    Guang-Ming Bian - MSFT
    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Wednesday, July 8, 2009 3:19 AM
  • Hi,

    The following is also useful to know :-

    http://blogs.msdn.com/anthonywong/archive/2006/03/13/550686.aspx

    Hope this helps.

    Paul Diston
    http://www.smartmobiledevice.co.uk/
    Wednesday, July 8, 2009 7:01 AM