Winsock gethostbyname() behaves different when debugging

Hello

I test porting a library in NI CVI 9.0 and I have just compiled a very simple DLL to perform a function of WinSock on XP SP3. When I run the executable from the command line, gethostbyname() returns the correct data. When I am debugging using the IDE of CVI 9.0, gethostbyname() returns-1.

I don't know where to start because I don't know why there should be a difference.

It is compiled into a DLL:

#include

#define LIBAPI __declspec (dllexport)

LIBAPI int WINAPI SYScurrentHost(char *buff, size_t buflen) {}

result = gethostname (chamois, buflen);

If result (result);

Return strlen (buff);

}

The main() which calls SYScurrentHost using (such as a console application) from the console returns the actual host name. But when I put a breakpoint in SYScurrentHost(), the result is-1 indicating an error. The LIB file for wsock32.lib is located in "C:\Program NIUninstaller Instruments\CVI90\sdk\lib\msvc\wsock32.lib" I've had to manually add (somehow I have a feeling that it shouldn't be necessary, but I got errors from the linker without him).

Thank you

Jason.

Before making any calls to Winsock, you must initialize the library by calling WSAStartup. You will notice that if you call WSAGetLastError once gethostname returns-1, it returns WSANOTINITIALISED. It appears that the creation of a command window should automatically initialize Winsock, although I have found no documentation to support this thesis.

A. Mert
National Instruments

Tags: NI Software

Similar Questions

  • JavaScript written in Dreamweaver behaves different when it is inserted into the Muse

    I have a simple list javascript that is written in Dreamweaver and works as expected, but when I copy and paste this exact javascript in html-object-section insert the result in Muse is different.

    Is there a place I can go to research on what I need to do different to make the code behave properly in the Muse? I don't understand what I need to change or do different.

    Here is the code that I had to work in Dreamweaver:

    <! doctype html >

    < html >

    < head >

    < meta charset = "utf-8" >

    list of < title > < /title >

    < script type = "text/javascript" >

    function fixTheList() {}

    var msg = "";

    var msg = "";

    If (document.getElementById("appleQty").value > 0) {}

    MSG += "apples";

    MSG += document.getElementById("appleQty").value;

    MSG += "< br >".

    }

    If (document.getElementById("orangesQty").value > 0) {}

    MSG += "Oranges";

    MSG += document.getElementById("orangesQty").value;

    MSG += "< br >".

    }

    If (document.getElementById("tangerineQty").value > 0) {}

    MSG += "mandarins."

    MSG += document.getElementById("tangerineQty").value;

    MSG += "< br >".

    }

    If (document.getElementById("kiwiQty").value > 0) {}

    MSG += "Kiwi";

    MSG += document.getElementById("kiwiQty").value;

    MSG += "< br >".

    }

    If (document.getElementById("pearsQty").value > 0) {}

    MSG += "Pears";

    MSG += document.getElementById("pearsQty").value;

    MSG += "< br >".

    }

    If (document.getElementById("grapesQty").value > 0) {}

    MSG += "grape";

    MSG += document.getElementById("grapesQty").value;

    MSG += "< br >".

    }

    If (document.getElementById("canteloupeQty").value > 0) {}

    MSG += "Canteloupes."

    MSG += document.getElementById("canteloupeQty").value;

    MSG += "< br >".

    }

    If (document.getElementById("strawberryQty").value > 0) {}

    MSG += "strawberry."

    MSG += document.getElementById("strawberryQty").value;

    MSG += "< br >".

    }

    document.getElementById("outputDiv").innerHTML = msg;

    }

    < /script >

    < / head >

    < body >

    < div id = "outputDiv" >

    < table >

    < b >

    < Td > < table > element

    Amount of < td > < table >

    < /tr >

    < b >

    Apples < td > < table >

    < td > < input type = "text" size = "3" id = "appleQty" > < table >

    < /tr >

    < b >

    Oranges < td > < table >

    < td > < input type = "text" size = "3" id = "orangesQty" > < table >

    < /tr >

    < b >

    Tangerines < td > < table >

    < td > < input type = "text" size = "3" id = "tangerineQty" > < table >

    < /tr >

    < b >

    Kiwi < td > < table >

    < td > < input type = "text" size = "3" id = "kiwiQty" > < table >

    < /tr >

    < b >

    Pears < td > < table >

    < td > < input type = "text" size = "3" id = "pearsQty" > < table >

    < /tr >

    < b >

    Grapes < td > < table >

    < td > < input type = "text" size = "3" id = "grapesQty" > < table >

    < /tr >

    < b >

    Cantaloupe < td > < table >

    < td >

    < input type = "text" size = "3" id = "canteloupeQty" >

    < table >

    < /tr >

    < b >

    Strawberry < td > < table >

    < td > < input type = "text" size = "3" id = "strawberryQty" >

    < table >

    < /tr >

    < /table >

    < input type = "button" value = "Stack" onclick = "fixTheList (); ">

    < / div >

    < / body >

    < / html >

    Hello

    Only difference I see is with the entry tag CSS properties.

    You can set the style of these tag by adding a few lines of code just belowtag in the code you paste in object > insert HTML code.<p class="reply"> <p class="reply">For example, you can add following codes</p> <p class="reply"><strong><style type="text/css"></strong></p> <p class="reply"><strong>  input {</strong></p> <p class="reply"><strong>    border: thin solid #AAA2A3;</strong></p> <p class="reply"><strong>    margin-bottom: 7px;</strong></p> <p class="reply"><strong>    margin-left: 9px;</strong></p> <p class="reply"><strong>}</strong></p> <p class="reply"><strong>  </style></strong>

    According to your requirement you can change.

    One tip more. Break your 3 codes part, tag Scripts, Style and tag Div in the body tag.

    Insert the Div tag in the body to object > insert HTML code

    Insert tags to Scripts, tag Style in Page > Page Properties > metadata > HTML for

    This will help you avoid unexpected in the preview behavior when you have stuff more inserted into the Muse Page.

    1 script tag (insert in the Page > Page Properties > metadata > HTML for))

    2 style Tag (insert in the Page > Page Properties > metadata > HTML for))

    3 Div tag in the body (insert in the object > insert HTML code)

    Agenda Quantity
    Apples
    Oranges
    Tangerines
    Kiwi
    Pears
    Grapes
    Cantaloupe

    Strawberry

    Concerning

    Vivek

  • Applications behave differently in "debug as" vs "run as" exported version vs - what happens?

    Hello

    I'm porting a java Flash game and it goes well. When I run it on a device (playbook in this case) or on the desktop through "debug as" the game works perfectly. I can load levels and play, no problem. However, when I do a ' run as ' instead, on the Playbook, the ball (it is a Pinball game) diseapers at some point (always the same). Worse still: when I export version release a I try, the level will not even run (the application stops responding).

    Who uses _exactly_ the same code. "Debug as" is OK, "run as" mostly OK, but loses the ball, 'export' accidents. This may be the cause? Different compiler options? I'm completely lost with this one, so any help is welcome.

    I use flex builder 4.5.1.

    Alain Daniel

    OK, I found the problem. The next line of the compiled code and has worked well in the debugging, but not in the version:

    trace ("some string") ();

    When you call the function that has this line, the framework seems to be analyzed (because the accident happens on the function call, do not loading the application), and somehow that threw a StackOverflowError on the line.

    Hope this can help someone else.

  • ADF CommandButton behaves differently when, in a popup window

    Hi all
    I have a page with input fields (af:inputText) and a popup with a commandButton control 'save' in it. The action of this button Save binds to my grain of support and so do all the input fields.
    When the user clicks 'save', the action method called getters of the input fields and use the GetValue method to get the user input. I'll then work with these values.

    This method works very well when the control knob is in the page (somewhere not on the shortcut menu), but when the button is moved in a popup window, geValue () will ignore all entries of the user and only returns the old value of input fields.

    for example, the loading of the page, I an entry submitted and indicates the current value
    Location: building 10

    and the user changes that for
    Location: building 20
    and save the clicks.

    Now, GetValue returns correctly "build 20' if the control button is not a popup and will return" to 10 "If the command button is in a popup."»»
    Part delivery is set to default (false) in both cases, and here is the declaration of popup, if this can help
     
    <af:popup id="confirm-saveTemplate"  contentDelivery="lazyUncached">
               <af:dialog id="d2" type="none">
    //a button here
    <af:commandButton text="#{rscBundle.SAVE}" id="cb4"
                    action="#{bean.save}"/>
               </af:dialog>
    </af:popup>
    Thanks in advance.
    (With the help of jDeveloper Version 11.1.1.6.0)

    Hello

    Part delivery is set to default (false) in both cases, and here is the declaration of popup, if this can help

    make it real

    Also define autoSubmit = true for the inputText

    Kind regards

    Published by: Santosh Vaza on 18 July 2012 10:20

  • GetActivePanel seems to behave differently for ConfirmPopup / MessagePopup and FileSelectPopupEx

    Hello

    I have a GUI with a XY Chart and to change the style of mouse (by default against the hair) and indicate the coordinates of graphic I use a timer control where the callback checks the coordinates of graphic.

    Because it can happen that a pop-up Panel appears, I also check the active panel is the current Panel to avoid having a mouse cursor focus on the pop-up Panel.

    The code is as follows:

    int CVICALLBACK MouseCursorTimer (int command face, int, int event, void * callbackData, int eventData1, int eventData2)

    {

    If ((événement == EVENT_TIMER_TICK) & (UtilityGetActivePanel () == sign))

    {

    the details of the graph using GetRelativeMouseState () and GetGraphCoordsFromPoint)

    ....

    As expected, the cursor will move style according to the position of the mouse. If I view a panel using InstallPopup () (which appears on the top of my chart), the cursor will move if placed default style on the popup panel. So far so good and I was happy--until I discovered that the other popup panels may behave differently...

    If I call ConfirmPopup or the cursor style MessagePopup mouse does not change, for example, it is shown as a focus, even if the mouse is placed over the popup panel.

    Interestingly, FilePopupEx () behaves correctly. Somehow, it seems that the Panel handle returned by GetActivePanel () depends on the pop-up Panel function called... It is by design or can it be fixed?

    Thank you

    Hi Wolfgang,.

    I slightly modified your program adding evidence when you set the cursor cross. It seems that the program sets the cursor again when navigating in the menu, even if the system is not honored by this parameter (it is probably correct that cursor remains that by default within the menu, right?). Question is why the system shows the cursor cross inside the pop-up window, but it is indeed honour your choice!

    As you already put out, the problem checks according to the State of the cursor when the window is issued and is not the type of window: I've added two options in the menu to display a panel with InstallPopup and display it in a floating window with DisplayPopup. This last option is useful to see what is happening in various situations when the window partially overlaps the chart, and you can click on it when coming from the area of tracing and the rest of the main window.

    It seems to me the system honors the cursor style when, within a Panel (perhaps because in this area, there are controls that could be exploited on, who knows?) while is shows the default cursor elsewhere.

    Since when the popup appears the timer code is never executed and change of cursor is done by the operating system, I guess the only solution you must exclude the timer of the cursor when you use in the menu.

    (you will see that I changed from 32-bit configuration: I wanted to check if that changes behavior, but it works the same way)

  • Expand/collapse PanelBox behave differently on wls integrated and stand-alone wls

    12.1.3 jdev

    WebLogic 12.1.3

    I have a test page which Expand/Collapse PanelBox according to a logic managed bean when a button is clicked. User can also manually click on the small triangle to open/close the group box.

    If I run my integrated weblogic Server page of jdev, everything works fine. PanelBox develops or reduced depending on the result of my bean managed after that I click on a button. After that I have manually expand/collapse it, by clicking the button again can expand or collapse the group box.

    But when I deploy my test on stand-alone weblogic server, by clicking on the button can expand/collapse the box. But if I manually expand/collapse the box for once, while clicking on the button after will not not expand/collapse the box not more.

    I check all the associated adf jars on integrated wls and wls autonomous. I have not noticed any difference.

    No idea why the same code behaves differently on different servers? Any suggestions that pot I should double check?

    Thank you.

    The difference has something to do with the doctors that we have configured on wls. We did the following and now the panelbox open/close correctly.

    1 Add a class to extend ComponentChangeFilter.

    SerializableAttribute public class RejectPanelComponentChangeFilter extends ComponentChangeFilter {}

    @SuppressWarnings("compatibility:-4979717484313581204")

    private public static final long serialVersionUID =-3565272558295489717 L;

    public RejectPanelComponentChangeFilter() {}

    Super();

    }

    Public ComponentChangeFilter.Result accept (ComponentChange, componentChange, UIComponent uIComponent) {}

    If (RichPanelBox instanceof uIComponent & "disclosed".equals (((AttributeComponentChange) componentChange) .getAttributeName ()) ") {}

    Return ComponentChangeFilter.Result.REJECT;

    }

    else {}

    Return ComponentChangeFilter.Result.ACCEPT;

    }

    }

    }

    2 and in the bean of backup of the page with panelBox on the PanelBox setter, follow these steps:

    {} public void setFinderCriteriaPanelBox (RichPanelBox finderCriteriaPanelBox)

    this.finderCriteriaPanelBox = finderCriteriaPanelBox;

    int filterCount = ((UIXComponentBase) finderCriteriaPanelBox) .getComponentChangeFilters () .length;

    If (filterCount == 0) {}

    finderCriteriaPanelBox.addComponentChangeFilter (new RejectPanelComponentChangeFilter());

    }

    }

  • APEX 4.2 Radio Group NULL value behaves differently than on APEX 4.1.1

    DB version: 11.2.0.3 Linux
    APEX: 4.2
    APEX listener 1.1.4 on tomcat6
    Firefox 16.0.2

    Values NULL Radio Group behave differently than on APEX 4.1.1.
    4.2 creating radio group and selecting:
    Display Null value = Yes
    NULL, Display value = no value (or any string)
    NULL Return Value = (leave blank, for the NULL value returned)

    When the user selects that option 'No value', then APEX point value is set on "on", but on APEX 4.1, the element has the value NULL as expected.

    When you look at the Web page source code, the reason seems to be that APEX does not generate an attribute value for the NULL value (if the browser returns the default "on"):
    <input type="radio" id="P1_X_0" name="p_t01"  ><label for="P1_X_0">No value</label>

    Hi Ilmar,

    same thing here. The best solution I could come up with is to create a process to request again (before the calculation / validation)

    BEGIN
      FOR x IN (
           SELECT *
           FROM (
             SELECT item_name
             FROM apex_application_page_items aapi
             WHERE aapi.application_id = :app_id
             AND aapi.page_id = :app_page_id
             AND LOWER (aapi.lov_display_null) = 'yes'
             AND aapi.display_as_code='NATIVE_RADIOGROUP'
             AND aapi.lov_definition IS NOT NULL
             AND aapi.lov_null_value IS NULL
             AND ROWNUM > 0
        ) x
              WHERE LOWER (v (x.item_name)) = 'on'
      ) LOOP
        apex_util.set_session_state (x.item_name, NULL);
      END LOOP;
    END;
    

    Jens

  • Published movie behaves differently on the web than it does on the local disk

    Hello

    I use basic addEventListeners and functions to create a basis for my home page navigation... when I test the movie on my local drive it fuctions perfectly, but when I download on the www, the movie behaves different... All buttons must be clicked two time to work properly... each uses touch charger UI to load the .swf appropriate clip but on first loading movies do not work correctly, when the same button is clicked again and once again, the film is loaded, it works very well. I noticed does not work because I have a preloader for each video clip that loads and click it on the first, the second click it works and because it works fine on my local drive I'm lost as to what I can do to solve the problem, or what is the problem... Help, please!

    The project is published on: http://sunnysideosc.ca/mainBeta1.htmlif you click on one of the buttons more than once, you will notice the bar preloader only works during the second click on the second time and 'philosophy' of scrolling...

    Thank you;

    Sam

    Here is a basic example of loading in a SWF file, then use:

    var LoadedSWF:Sprite;

    function loadSWF (path: String): void {}

    var swfLoader:Loader = new Loader ();
    swfLoader.addEventListener (Event.COMPLETE, loadSWF_onComplete);
    swfLoader.load (new URLRequest (path));

    }

    function loadSWF_onComplete (event: Event): void {}

    If (LoadedSWF! = null) {}

    removeChild (LoadedSWF);

    }

    LoadedSWF = event.target.content as Sprite;
    addChild (LoadedSWF);

    }

    loadSWF ("MySWF.swf");
    LoadedSWF.myCustomFunction ();

    By operating the complete Manager, event.target is the Loader object. You can technically addChild the Loader object, but I'd rather not because it makes it easier to refer directly to my custom SWF, and because it can make it easier to fade in the loaded movie or other operations once it's finished loading.

    I know that what I just wrote is similar to what you have already, but I felt that it would be useful to give an example. By the look of your code, you seem to be reusing your Loader object. It might work if you used objects separated from Loader loading the separate SWF files better.

  • iOS10 live wallpaper behaves differently?

    Hi, I just got my new iPhone Plus 7 and it seems that the Live wallpaper behaves differently than in iOS9.

    Namely, in the old system (on an iPhone 6 more) by varying the pressure on the screen I can control precisely of the wallpaper Live playback speed and easily play to the front/rear.

    In iOS 10 (on the new iPhone 7 more) it seems that the reading speed of the Live wallpaper has no can be controlled by the pressure.

    Is this normal? Or do I use a screen may be defective? Thank you!

    Same here on iOS iPhone 7 10.0.1

  • In FF4, why my site is different when www is omitted

    My site is different when I use www in the address and when I omit www. Look at http://www.dynapipe.co.uk and http://dynapipe.co.uk.

    This does not happen with FF3 or IE7, 8 or 9 or Google Chrome, only FF4

    Try to reset the Zoom factor on each of these pages, a 'domain' is probably zoomed in or out.

    https://support.Mozilla.com/en-us/KB/page+zoom

  • CoverageInfo behaves different OS &gt; = 4.7

    I found that the CoverageInfo class produced different results on the new BlackBerry OS (4.7, 5.0), according to the JDE used to compile the application.

    Try to compile this piece of code for JDE 4.5 and run on a BIS device with compatible OS > = 4.7 (Storm, Storm 2, Bold 2)...:

    int status = CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_BIS_B;
    if(status == 0){
        System.out.println("No BIS Coverage");
    } else {
        System.out.println("Coverage OK");
    }
    

    Now compile it for a new OS (> = 4.7) and test it again on the same device. Surprised?

    I think that it is a serious problem, because this control is useful for determining if a BIS device has enough coverage to make connections.
    I have not tested CoverageInfo.COVERAGE_MDS yet because I don't have any active BES device available at the moment, but I suspect that the same thing can happen.

    I found that the problem was on getCoverageStatus, which behaves different from isCoverageSufficient. I replaced this line and now it works. Thanks to kyublin on this post for the discovery.

  • Panels of data/chip data lost when debugging

    Using JDev 12 c -.

    Java (TM) Platform1.7.0_40
    Oracle IDE12.1.2.0.40.66.68
    Support for versioning12.1.2.0.40.66.68

    I've lost data and SmartData panels at the bottom of the screen when debugging.    I have a range of watches, but it's the only visible.

    How can I get back them?

    Hello

    In the main menu, select Windows-> debugger-> choose your data and the smart windows.

    Concerning

  • Why does an image seem different when I'm going to point to the library back

    Why an image look different when I go to develop the library or back.  The histogram doesn't seem to change, but you can see a difference and I printed the and see the difference.  Very strange and I don't know how to process the image

    > Person adobe and they said it's because develop use proPhoto and library use sRGB and users go between D L & until they get the picture they want.

    Yes it is misinformed. Only on a few screens of high quality should you be able to see a difference, and even then it will only appear in a few images and be quite subtle. If you see differences between the library and to the point, it is almost always a bad monitor profile that is fixed by the recalibration of the screen using calibration material (essential equipment when you do photography on any computer) or it's the problem has already been mentioned with the gpu acceleration not loading right monitor profile. Which is fixed by disabling GPU acceleration in LR 6/CC.

  • "Matches regular Expression" and "Model match" vi behaves differently

    Hello

    I need a simple matching chain and experimenting that found the "Regular Expression Match' and 'Correspondence model' vi behave a little differently. I guess that the entries of the regular expression on the two the same behavior. It's a difference that I discovered that the "|" character ("vertical" character, commonly used as an operator 'or') is recognized as such in the regex to Match vi, but not in the match vi model (where it is taken to the letter). Furthermore, I can't find any document using (online or in LabVIEW) on the ' | ' usage in regular expressions of character. Is - this documented anywhere?

    For example, suppose I want corresponding to one of the following 4 words: 'The' or 'fast' or 'brown' or 'fox '. The regular expression ' the | fast | Brown | Fox' (without the quotes) works for the vi Regular Expression Match but not the match pattern vi. Here is a photo of the block diagram and the results of the façade:

     

    The Help explains that the vi Regular Expression Match performs a little more slowly the match vi pattern, so I started with the latter. But since he does not work for me, I'll use the old. But does anyone have an idea of the speed difference? I guess that's negligible in a simple example.

    Thank you!

    Thank you, Jeff. That's what I was looking for. BUT my version of LabVIEW 8.5, does NOT say "functionfor example, the Match model does not support the parenthesis or vertical bars (|) characters.«» !

    See: http://zone.ni.com/reference/en-XX/help/371361D-01/glang/match_pattern/

    and http://zone.ni.com/reference/en-XX/help/371361D-01/glang/match_regular_expression/

    It is not mentioned in the help of special characters used for the match pattern : http://zone.ni.com/reference/en-XX/help/371361D-01/lvhowto/specialcharformatchpatt/

    The only place | has 'talked', it is in the sentence: "some regular expressions that use alternating (such as (. |))". \s)*) require significant resources to deal with when it is applied to the large input strings. "But I'm not processing a large chain.

    It seems that NEITHER fixed this omission. What version is your help?

    Ed

  • Failed to launch! ApolloLaunchDelegate.fileDoesNotExist! in Flash Builder when debugging AIR applications

    Hello world

    I use flash/flex builder for years, but have never tried to create an AIR application before.  I tried to create a 'Hello' world app before wearing some of my stuff by following the instructions here:

    http://help.Adobe.com/en_US/air/1.5/devappsflex/WS5b3ccc516d4fbf351e63e3d118676a28bd-8000. HTML

    "but when I try to debug the code, I get the a dialog box"Unable to launch"with the useless comment! ApolloLaunchDelegate.fileDoesNotExist!'.

    I'm running win7x64, SDK 4.1

    I tried all kinds of different files in the AIR, including the value by default when you create an empty project and the conversion of copies of some of my existing flex projects on the desktop, but they all give the same message.

    Google does not help.  Any ideas would be welcome.

    Kenneth

    EDIT: just tried the same thing on my same version of flash builder on my laptop and it works... The laptop working Vistax64.  The only other different is that when I chose SDK 4.1 in the new project dialog box, he said, AIR 2.0, while on this machine, say, he needed air 1.5

    Post edited by: kennethGilpin

    Hello

    You can check whether a SWF file has been generated in your bin-debug folder? Looking at the code FB, this happens when the SWF file does not exist. (Although I don't know why the error message is incorrect for you. Did pass you to FB 4 to 4.0.1 or are you on an own 4.0.1 install?)

    Try to check your view of 'Problems' to see if there are any compiler errors.

    Thank you

    Rémy

Maybe you are looking for