Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


SDI App does not run on all pcs

Posted on 2009-05-15
Medium Priority
Last Modified: 2013-11-20
I have an app that runs fine on my development pc but does not run on target pc. Both are XP-SP2. The program was built using VC++ 2008. I linked as static without CRL or ATL. The gui portion works on both pcs, but on the target pc it will not send UDP packets over sockets. Any ideas of what to look at? I am not even sure what code to provide since no errors are being reported. I can provide some if when we narrow down the possibilities..
Question by:tholt1
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 40

Expert Comment

ID: 24400685
Describe where the 2 PCs are relative to each other and describe where they are trying to send data to. Are you sending to addresses by hostname or by IP address.

Without more info it is hard to say whether this may be firewall related, DNS related, or what.

Have you any debugging / error checking to verify the winsock calls are succeeding?


Author Comment

ID: 24401217
The PCS are on a private lan, no firewall, sending by ip-address. The problem I have is that my target machine will not have visual studio loaded onto it. A different program that uses the UDP protocol does work on both machines. Since the GUI is working fine (CFormView and CDialog derived classes), it does not seem to be MFR/CLR/ATL related. Since I linked MFC statically and excluded CLR and ATL, it does not seem like I should need any type of runtime environment. Do I? As far as the winsock calls go, they work on my "development" pc.

Author Comment

ID: 24401492
I got it working, although I obviously need a better understanding of how socket creation works. I realized on the PC that worked, I had put some bogus entries into the "hosts" system file. I used the method gethostbyaddr to translate a ascii string ip-address to a convert to hostent. Is there a method that does not require me to modify the "hosts" system file? Any ideas?
// szTempSrvName = "" and is null termed
      addr = inet_addr((const char*)szTempSrvName);
      hp = gethostbyaddr((char*)&addr,4,AF_INET);

Open in new window

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

LVL 40

Expert Comment

ID: 24404157
Yes, don't use hostnames, just use IP addresses and there will be no requirement for accessing the hosts file.
The gethostbyaddr() does a reverse lookup. You don't need it for socket communications. Is there a reason you need reverse name lookup?


Author Comment

ID: 24472859
Sorry for the delay, I was out of office last week. I do not need (nor want) to use hosts file. I was just following example in help. Is there an example that shows how to populate the sockaddr_in struct that does not use gethostbyaddr()?
LVL 40

Accepted Solution

mrjoltcola earned 1000 total points
ID: 24473851
Well, you don't need the "hp" (hostent) variable to do socket communication. All you need is the "addr" structure. Try commenting the 2nd line of code out, in your sample above. Since I cannot see the rest of your code, I cannot say more.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question