SDI App does not run on all pcs

Posted on 2009-05-15
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
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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 250 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
not able to insert into temp table 68 169
viewing source code from eclipse 13 110
post4 challenge 28 105
Updating statistics with error notification email in SQL server 4 110
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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 video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

830 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