Find the device on the network

Could someone please explain to me how to find a device on a network - use the multicast or broadcast?

I want to find the ip address of my server on wlan and there may be multiple instances of these servers. The server uses this http://www.blackberry.com/developers/docs/7.0.0api/net/rim/device/api/io/MulticastDatagramConnection... class and receives repsonses ok. Java then sends a rear channel.

I get only the following c ++ side while I'm hoping to receive a string any (that im sending java) so I can identify what responses come from my server. and which are not.

M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
St:urn:schemas - upnp - org:device:InternetGatewayDevice:1
MAN: "" ssdp: discover ""
MX:3

And here is my code to send and receive...

int receiveMulti()
{
     struct sockaddr_in addr;
     int fd, nbytes,addrlen;
     struct ip_mreq mreq;
     char msgbuf[1024];

     u_int yes=1;            /*** MODIFICATION TO ORIGINAL */

     /* create what looks like an ordinary UDP socket */
     if ((fd=socket(AF_INET,SOCK_DGRAM,0)) < 0) {
      perror("socket");
      exit(1);
     }

/**** MODIFICATION TO ORIGINAL */
    /* allow multiple sockets to use the same PORT number */
    if (setsockopt(fd,SOL_SOCKET,SO_REUSEADDR,&yes,sizeof(yes)) < 0) {
       perror("Reusing ADDR failed");
       exit(1);
       }
/*** END OF MODIFICATION TO ORIGINAL */

     /* set up destination address */
     memset(&addr,0,sizeof(addr));
     addr.sin_family=AF_INET;
     addr.sin_addr.s_addr=htonl(INADDR_ANY); /* N.B.: differs from sender */
     addr.sin_port=htons(1900);

     /* bind to receive address */
     if (bind(fd,(struct sockaddr *) &addr,sizeof(addr)) < 0) {
      perror("bind");
      exit(1);
     }

     /* use setsockopt() to request that the kernel join a multicast group */
     mreq.imr_multiaddr.s_addr=inet_addr("239.255.255.250");
     mreq.imr_interface.s_addr=htonl(INADDR_ANY);
     if (setsockopt(fd,IPPROTO_IP,IP_ADD_MEMBERSHIP,&mreq,sizeof(mreq)) < 0) {
      perror("setsockopt");
      exit(1);
     }
     printf("beforeread");
     fflush(stdout);
     bool keepGoing = true;
     int count = 0;
     /* now just enter a read-print loop */
     while (keepGoing) {
         count++;
      addrlen=sizeof(addr);
      if ((nbytes=recvfrom(fd,msgbuf,1024,0,
                   (struct sockaddr *) &addr,(socklen_t*)&addrlen)) < 0) {
           perror("recvfrom");
           exit(1);
      }
      msgbuf[nbytes] = '\0';
      printf("received: %d  %s", nbytes, msgbuf);
      fflush(stdout);
      if(count > 5)
      {
          break;
      }
     }
}

int sendMulti ()
{
     struct sockaddr_in addr;
     int fd, cnt;
     struct ip_mreq mreq;
     char *message="83383329092240912";

     /* create what looks like an ordinary UDP socket */
     if ((fd=socket(AF_INET,SOCK_DGRAM,0)) < 0) {
      perror("socket");
      exit(1);
     }

     /* set up destination address */
     memset(&addr,0,sizeof(addr));
     addr.sin_family=AF_INET;
     addr.sin_addr.s_addr=inet_addr("239.255.255.250");
     addr.sin_port=htons(1900);

     /* now just sendto() our destination! */
    // while (1)
     {
      if (sendto(fd,message,sizeof(message),0,(struct sockaddr *) &addr,
             sizeof(addr)) < 0) {
           perror("sendto");
           exit(1);
      }
      sleep(1);
     }
}

tjhanks.

It turns out that my hypothesis the code example I used sends the group with this line of code is incorrect...

String remoteAddr = dgram.getAddress();
   String msg = "Hi";

   dgram = conn.newDatagram( msg.getBytes(), msg.length(), remoteAddr);

remoteAddr gives me //192.168.0.5:65228;4321| rear UDP I used to send the data back to c ++ but when I just changed my group address and port manaually packets are received on the side of c ++.

Tags: BlackBerry Developers

Similar Questions

  • HP Pavilion dv6910us can't find the network device driver

    My computer laptop specifications:

    Product name: dv6910us

    Product number: FE653UA #ABA

    My problem:

    Windows 7 32 bit does not have the network adapter network driver.

    I tried to connect online network Port RJ45, flickered light in this RJ45 port, it is good work.

    --------------

    Could find you out for me, the network on the laptop HP Pavilion dv6910us driver? You can find the network driver to aid for all Version of Vista or Win 7 operating system 32 and 64-bit.

    Thanks for the help!

    Huy, LD

    Hello:

    This driver should install the wired ethernet adapter.

    http://h10025.www1.HP.com/ewfrf/WC/softwareDownloadIndex?softwareitem=ob-55781-1&CC=US&DLC=en&LC=en&os=2093&Product=3740556&sw_lang=

  • How to recover or find the network key for a router wireless (Netgear)

    Network wireless adapter NIC Ethernet network device

    How to recover or find the network key for a router wireless (Netgear)

    Hi RaymondKramp,

    ·         What version of Windows is installed on your computer?

    If you have lost the key to network and not connected to the network, then you can reset the router to factory settings wireless.

    If you lost the key network and connected to the network, and then log on to the Web page of the router and get the key.

    For more assistance, you can contact Netgear Support:

    http://support.NETGEAR.com/app/home

    Hope this information helps.

  • Windows 7 can not find the network

    Hi guys I hope that someone can help me, I walked trough the forums but none of the above helped me. I also do not really understand some of them. But that's what happened. My internet was fine yesterday, I was watching some stuff on aliexpress when my mouse froze, I tried to restart the laptop, but nothing worked so I had to remove the battery. After that the computer took forever to turn back and when he did my computer did not find my wifi more. I ran the following anti-virus, I tried the steps in the verification of all past system. I went in Sync Center, I have trid addition in manual, I tried to search for a wifi switch (I don't think I have a) I tried to restart the pc and the internet, I tried the system restore, I don't really know what else to do. Any suggestions?

    Hi Kate,.

    Thanks for posting your query in Microsoft Community.

    I understand that Windows 7 can't find the network and I appreciate the efforts made to try the patches. Let me ask you;

    • Restoring the system led?
    • What exactly happens when you try to connect to the Wi - Fi?

    This could be due to several reasons, including any third party software conflict. Try the following methods and check.

    Method 1: Start the computer in Mode safe mode with network and check if the problem persists. If the problem does not persist in SafeMode with network, put the computer in a clean boot state and check.

    Step 1: Start the computer using safe mode with networking

    Safe mode with networking is an option of troubleshooting for Windows that starts your computer in a limited State. Only basic files and drivers needed to run Windows are started. Safe Mode with networking appears in the corners of your monitor to identify which Windows mode you are using. You can use the internet connection in this mode.

    Please refer to: , start your computer in safe mode

    Step 2: Perform a clean boot in order to avoid any conflict of third party software.

    To help resolve the error and other messages, you can start Windows by using a minimal set of drivers and startup programs. This type of boot is known as a "clean boot". A clean boot helps eliminate software conflicts.

    Place your system in the clean boot state helps determine if third-party applications or startup items are causing the problem. You must follow the steps in the article mentioned below to perform a clean boot.

    How to perform a clean boot in Windows

    Note: see 'How do I reset the computer to start normally after a boot minimum troubleshooting' to reset the computer starts normally after troubleshooting.

    Method 2: Update the network adapter

    Step 1: Update the driver through Device Manager

    a. click Start , type Device Manager and click on it

    b. expand network adapters

    c. make a right click driver, and then click Update driver software

    Step 2: Install the Windows updates pending

    To check the updates:

    1. Open Windows Update by clicking the Start button . In the search box, type Update, and then in the list of results, click Windows Update.
    2. In the left pane, click check for updates, and then wait while Windows searches the latest updates for your computer.

    3. If you see a message telling you that important updates are available, or you say to look at the important updates, click the message to view and select the updates to install.

    4. In the list, click the important updates for more information. Select the check boxes for the updates that you want to install and then click OK.

    5. Click install updates.

      Read and accept the terms of the license and then click Finish if the update requires it. If you are prompted for an administrator password or a confirmation, type the password or provide confirmation.

    Step 3: Visit the computer manufacturer's support Web site and install the latest network for Windows 8 for the same model of device drivers.

    Additional information:

    Wireless and wired network problems

    Hope this information is useful. Please feel free to answer in the case where you are facing in the future other problems with Windows.

  • How to find the network security key

    Where can I find the network security key

    80sAngels wrote:

    Where can I find the network security key

    Hello

    It should be in your AP (access point/router). Please log in to it and find out.

    Kind regards.

  • Equium A110-252 - how can I find the network drivers?

    Hi guys :)

    I have just reinstalled Win XP on a model number Equium A110 - 252 PSAB2E
    Can't find driver for network controller... everyone has ideas?
    Ive looked for in these forums, but in vain :(
    any help would be appreciated

    Thank you

    GW

    Have you looked on the Toshiba site?
    You will find the network driver and all other drivers.

    http://EU.computers.Toshiba-Europe.com-online decision-making supported Downloads & => Download drivers

  • When I perform a net view on, I get the error system error 51 next. Windows cannot find the network path.

    Net 51 with a view system error

    I have two boxes of Windows XP that I login as administrator account. I was able to synchronize files, map network drives and can do a tracert to reach one of them.

    However, when I perform a net view on, I get the following error

    51 system error has occurred.

    Windows cannot find the network path. Make sure the network path is correct and the destination computer is not busy or turned off the coast. If Windows still can't find the network path, contact your network administrator.

    How to make this command work?

    Hello

    ·         Your computer is on a domain network?

    Follow the steps in troubleshooting this article and check if that helps:

    You cannot access shared files and folders or browse computers in the workgroup with Windows XP

    http://support.Microsoft.com/kb/318030

    See also this article that resembles the same error.

    Error when you try to access shared resources on a computer that is running Windows 2000 or Windows Server 2003: "53 system error has occurred" or "51 system error has occurred."

    http://support.Microsoft.com/kb/259878

  • I can´t find the network controller driver. Is Hp 2000 - 2d09EE, 8 x 64 windows. Please can you help me?

    Hello

    I can´t find the network controller driver. Is Hp 2000 - 2d09EE, 8 x 64 windows. Please can you help me?

    PCI\VEN_168C & DEV_0036 & SUBSYS_217F103C & REV_01
    PCI\VEN_168C & DEV_0036 & SUBSYS_217F103C
    PCI\VEN_168C & DEV_0036 & CC_028000
    PCI\VEN_168C & DEV_0036 & CC_0280

    Direct link is here

    http://ftp.HP.com/pub/SoftPaq/sp62001-62500/sp62425.exe

  • My Windows 7 computer will not find the networks wireless after a system restore.

    My Windows 7 computer is not find wireless networks after I did a system restore. It was perfectly good wifi before the system restore and other members of my family have a great connection except me is not a problem with my router. I think I know what the problem is, but I just don't know how to fix it. So there you go. I did my restore system about 2 days after that we moved on the provider of internet/tv "Comcast" to the tv/internet provider "Verizon". what I think has happened, is that I restored my computer to the point when we had no Verizon so that he could not find the network. Now, since we have Comcast it won't identify this network either, so maybe some of you out there could help me. : D

    Hello Nicolas,.

    Thank you our writing about Microsoft Community.

    If your computer has a wireless network card, Windows will automatically detect the networks wireless in range of your computer.

    You may encounter network or problems of Internet in Windows for several reasons.  Some common problems that can cause these problems are:

    • A wireless network adapter switch that is not enabled

    • WEP, WPA, or WPA2 key or password security issues

    • Cables that are not connected correctly

    • Corrupt or incompatible drivers

    • Missing updates

    • Network connection settings

    • Hardware or software problems

    I would ask you to check out the troubleshooting steps provided in the articles below and check if they help you solve the issue.

    Why can't I find a wireless network?

    Wireless and wired network problems

    Here are some links to site Web de Support of Comcast, who talk about troubleshooting of XFINITY Internet connectivity issues.

    XFINITY TV App: Can't detect your XFINITY home network

    The problems of XFINITY Internet connectivity

    Hope the helps of information provided. Do we know the State of the question, so that we can help you further.

    Thank you.

  • My computer has virus of the FBI, I wiped it is clean but now it cannot connect to intermet because it can't find the network driver how can I find it?

    My computer has virus of the FBI, I wiped it is clean but now it cannot connect to intermet because it can't find the network driver how can I find it?

    Since you have formatted the PC and reinstalled Windows, your question will be handled better in the hardware forum space and drivers for Windows 7, so I'll move it there.

    Apparently, you need to install the driver of your PC network. If you used the CD to restore the PC manufacturer that should have been included, but it may be on a 2nd CD with drivers and programs.

    If not, the first thing to do is contact the PC manufacturer to see if they have a driver available for download. If the PC has a wireless network card and wired, perhaps one has been configured, but not the other and you try to use the not yet detected and installed.

    -steve

  • Can not find the network controller PCI device

    PCI hardware ID are:

    PCI\VEN_10EC & DEV_5229 & SUBSYS_1858103C & REV_01

    PCI\VEN_10EC & DEV_5229 & SUBSYS_1858103C

    PCI\VEN_10EC & DEV_5229 & CC_FF0000

    PCI\VEN_10EC & DEV_5229 & CC_FF00

    Material for the network controller IDS are:

    CPI\VEN_168C & DEV_0032 & SUBSY_1785103C & REV_01

    CPI\VEN_168C & DEV_0032 & SUBSY_1785103C

    CPI\VEN_168C & DEV_0032 & SCC_028000

    CPI\VEN_168C & DEV_0032 & SCC_0280

    Hello:

    The 168 is this one...

    http://h20000.www2.hp.com/bizsupport/TechSupport/SoftwareDescription.jsp?lang=en&cc=us&prodTypeId=321957&prodSeriesId=5060880&swItem=ob-108905-1&prodNameId=5060882&swEnvOID=4052&swLang=13&taskId=135&mode=3

    The other is...

    http://h10025.www1.HP.com/ewfrf/wc/softwareDownloadIndex?softwareitem=ob-104710-1&cc=us&DLC=en&LC=en&OS=4062&product=5277691&sw_lang

    Paul

  • HP2000 2D09SLA, cannot find the network controller driver after reclassification of win8 base to win8pro

    HP2000 2D09SLA, PROFESSIONAL 64 BITS OF WINDOWS 8.

    After installing windows8pro, I could not find driver for network controller, since then I can not use my wireless.

    Hello:

    Follow these steps, and I'll post the link to the wireless driver you need...

    Go to Device Manager, find the other devices category, click the network controller needing drivers.

    Then click on the Details tab at the top of the control of the network window.

    Now, you see a drop-down list of property and it is set by default to the Description of the unit.

    Drop down on it and select the second item in the list (Hardware ID).

    After the first string of characters that start with PCI\VEN.

  • Satellite A500-15N: could not find the network adapter XP driver

    Hello world

    I just blown away vista on my new A500-15N and installed XP + SP2.
    The installation went well but I have some problems with some devices does not.

    They are: 3 x of the device Base, 1 x Ethernet, 1 x network controller controller system, 2 x PCI device, 1 x controller Bus SM, 1 unknown device x and 1 x video controller (VGA Compatible).

    I thought that I would be able to load network card drivers in order to allow access to the internet and then be able to download everything, either automatically, or manually. But I can't have any network card to load drivers!

    After loading some on the Toshiba web site, it makes no difference.
    I deleted and then to detect automatically the network card in Device Manager, but I can't find any drivers installed to run.

    Anyone know what I can do to fix this, or any other issue?

    Thank you

    MrAngry

    Hello

    Do you need the card network LAN driver Wlan or both pilots?
    As far as I know the piece of LAN card is Realtek (1 Gbps) and the Intel 5100AGN WLAN.

    The WLan driver can be found here:
    http://APS2.toshiba-tro.de/WLAN/?page=downloads
    Intel PRO/Wireless 3945, 4965, 5100, 5300

    The driver LAN on the Realtek page:
    http://www.Realtek.com.tw/

    You can consult the page of the European driver Toshiba. Other series of laptops use the same Realtek LAN card and the driver should work too.

  • Cannot find the network-

    Hello - my laptop has a Wi - Fi connection and net access.

    For a long time, I was using the laptop with the wireless connection. My router assigned 192.168.1.237 to the Wi - Fi connection.  I was able to map the disk on the laptop and remote access.

    A month ago I connecting the laptop to my home network via a wired connection to 192.168.1.172 - once again, I make me connections to and from the laptop.

    Now, I disconnect the wired connection and now the laptop seems to have trouble finding the other computer on the network or if the laptop can be found

    computer too.

    Don't know if it's an OS problem or a problem with my router and DNS - any suggestions on how to get the laptap back on the network with the

    WiFi would be appreciated.

    NO, but a password is required to connect to the wireless network.

    You must have a cryptographic, or otherwise you wouldn't need a password.  If there is no encryption configured in your router, where is the need for a password from a?

    Determine the IP addresses of other devices on your network (for Windows computers, run an ipconfig command in a command prompt window).

    They should all be a 192.168.1.xxx where xxx is greater than 1 and less than 254.  Are they?

    Open a command prompt window and type

    Ping

    What is going on?

    Given your description of what works and what does not work, I can only think of two possible explanations:

    • Some firewall 3 rd-party blocks wireless connection: what security software is installed, including your antivirus program, any firewall program, any program antimalware, etc.. ?
    • You are currently connected to the network wireless to a neighbor with the same SSID (network name).  It would be very likely if you, indeed enter a password to connect wireless
  • Cannot find the network on HP Pavilion

    Hello
    I don't find my network wireless on my HP Pavilion. It lists a whole bunch of other networks except me. Ive tried unsuccessfully to troubleshooting.
    It was fine this morning and I have wireless on my phone, so it's the computer. My product number is E4X87PA #ABG. Any help would be greatly appreciated.
    Thank you
    M

    Hi @MaryamCD

    Welcome to the HP Support Forums, I hope you enjoy your experience! To help you get the most out of the Forums of HP, I would like to draw your attention to the Guide of the Forums HP first time here? Learn how to publish and more.

    I saw your post about wireless problems you are having with your Pavilion. Have you tried to connect to any of these other networks to make sure that your wireless network is able to connect and funtion correctly? In general, if you can see the other networks it could be something on the network at the origin of the problem. If you have not had the chance to unplug your wireless router and the model please do. Leave of them disconnected for 30 seconds, and then reconnect hide them in. Then see if you can see your network again.

    What operating system do you use? What have listed it under network adapters in your device manager? What is the product number for your Pavilion?

  • How to reset or find the network security key

    Hello!

    I tried to get my laptop connected to my new modem/Wi-Fi device and asked me to put a network security code, and without knowing what I was doing in fact I just typed something and changed my network security key. I just want to know how to reset so I can get the laptop to connect to my WiFi. What should I do?

    Hello George,

    Thanks for posting your question on the Microsoft community.

    Thank you for your query details.

    I also appreciate the fact that you want change or find the security key for your network.

    You may not reset the network security key.

    I suggest you to refer to this article and check if it helps.
    Reference:
    How to find your wireless network password
    https://www.Microsoft.com/surface/en-us/support/networking-and-connectivity/how-to-find-your-wireless-network-password

    Additional information:
    Set up a security key for a wireless network
    http://Windows.Microsoft.com/en-us/Windows/set-security-key-wireless-network#1TC=Windows-7

    I hope this information helps.

    Please let us know if you need more help.

    Thank you

Maybe you are looking for