locked
Communication between two mobiles RRS feed

  • Question

  • Hi,

    Is it possible to create an application that can sent and receive messages from other mobile using application. I am talking something like Client Server application/Peer to Peer application?

    Is there any way to communicate except internet?

    Thanks
    Monday, March 1, 2010 9:41 PM

Answers

  • Honestly I think SMS is your best bet. The problem you will encounter in trying to perform direct mobile-to-mobile communication is discoverability and addressing. You won't be able to easily find out the address of the device you wish to contact. Even if you do find out the address a lot of mobile networks assign private IP addresses to their mobile devices. So there may be no way to open up a pathway from one device to another. The solution for these problems is to have an easily discoverable server that both devices can use. But you mentioned above that you are trying to do peer-to-peer and not client-to-server.
    It takes all the running you can do to stay in one place.If you want to get somewhere else,you must try to run at least twice as fast as that.
    Monday, March 1, 2010 10:25 PM

All replies

  • Honestly I think SMS is your best bet. The problem you will encounter in trying to perform direct mobile-to-mobile communication is discoverability and addressing. You won't be able to easily find out the address of the device you wish to contact. Even if you do find out the address a lot of mobile networks assign private IP addresses to their mobile devices. So there may be no way to open up a pathway from one device to another. The solution for these problems is to have an easily discoverable server that both devices can use. But you mentioned above that you are trying to do peer-to-peer and not client-to-server.
    It takes all the running you can do to stay in one place.If you want to get somewhere else,you must try to run at least twice as fast as that.
    Monday, March 1, 2010 10:25 PM
  • Hi,

    it's like you can talk that you can connect PC to PC directly and get connected and send/receive machine in one another machine. But on wireless devices this is very tough task. And no mobile brand disclose their private code for that type of connection. For that you have to require source code of any mobile deeply. and you can modify it.

    So, SMS is through internet OR send SMS on direct number is great way i think.


    Friday, May 18, 2012 6:20 AM
  • Hi,

    it's like you can talk that you can connect PC to PC directly and get connected and send/receive machine in one another machine. But on wireless devices this is very tough task. And no mobile brand disclose their private code for that type of connection. For that you have to require source code of any mobile deeply. and you can modify it.



    The problem isn't with the platform. Even with PC to PC communication if those PCs are using a mobile connection the same problem would be encountered; many networks simply do not support incoming connections. The same problem occurs on some home internet connections (not all ISPs give their customers public IP addresses). If your network/ISP doesn't support it no amount of modification of the operating system's code will compensate.

    Joel Ivory Johnson | http://www.j2i.net | Windows Phone Developer MVP
    It takes all the running you can do to stay in one place.If you want to get somewhere else,you must try to run at least twice as fast as that.

    Friday, May 18, 2012 1:20 PM
  • Sir You Can do That by use winsock on few Step's

    Client Side

    1. Initialize the winsock2 Library with specific version you can check version Number From Microsoft  


     wVersionRequested = MAKEWORD(2,0);
    Status = WSAStartup (wVersionRequested, &wsaData);
    if (Status != 0) {
    ShowErr (TEXT("WSAStartup call failed!!, Error %d\r\n"), WSAGetLastError());
    return;
    }

     Sock = socket(AF_INET, SOCK_STREAM, IPPROTO_IP);

    if ( Sock == INVALID_SOCKET )
    {
    MessageBox(TEXT("Error: failed to create socket\n"),MB_OK);
    fflush(0);
    return ;

    2. This function creates a socket that is bound to a specific service provider, if you want to connect through TCP Protocol or UDP  etc... 

    3. Prepare Server Socket : I mean detect which IP and Port Number then you can call the connect function to try connect on this Server. 

    if ( connect( Sock, (SOCKADDR*) &m_ServerSockAddr, sizeof(m_ServerSockAddr) ) == SOCKET_ERROR)
    {



    now you can Create Thread to Do that and sent data

    int nSend=send(Sock, bmpBuf, fileLen, 0);


    on Server Side

    /*1*/WORD VersionRequested = MAKEWORD(2,2);
    WSADATA wsaData;
    WSAStartup(VersionRequested, &wsaData); // Start Winsock Service
    if ( wsaData.wVersion != VersionRequested )
    {
    MessageBox(TEXT("Wrong version or WinSock not loaded\n"),MB_OK);
    fflush(0);
    }
    /*2*///create socket function we disucs what this function mean
    m_Socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
    if ( m_Socket == INVALID_SOCKET )
    {
    MessageBox(TEXT("Error: failed to create socket\n"),MB_OK);
    fflush(0);
    return false;
    }
    /*3*///To Crate Socket listen from any Client you can change it, by detect IP
    m_ServerSockAddr.sin_family = AF_INET;
    m_ServerSockAddr.sin_addr.s_addr = htonl( INADDR_ANY );
    m_ServerSockAddr.sin_port = htons(987);

    BOOL temp;
    int len=sizeof(BOOL);
    int hr;
    /*4-
    This function is used on an unconnected socket before subsequent calls to the connect or listen function. The bind function is used to bind to either connection-oriented (stream) or connectionless (datagram) sockets. When a socket is created with a call to the socket function, it exists in a name space (address family) but has no name assigned to it. Use the bind function to establish the local association of the socket by assigning a local name to an unnamed socket.
    */
    if ( bind( m_Socket, (struct sockaddr *)&m_ServerSockAddr, sizeof(m_ServerSockAddr)) != 0 )
    {
    MessageBox(TEXT("Error: failed to bind\n"),MB_OK);
    closesocket( m_Socket );
    return false;
    }
    /* 5
    This function places a socket at a state where it is listening for an incoming connection.
    */
    if ( listen(m_Socket,SOMAXCONN) != 0)
    {
    MessageBox(TEXT("Error: failed to Listen\n"),MB_OK);
    closesocket( m_Socket );
    return false;



    also you can check my Article on 

    http://www.codeproject.com/Articles/387524/Remote-windows-mobile-Device-Using-Winsock

    Friday, May 25, 2012 2:02 PM