CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2010
    Posts
    38

    How send data to my server?

    Dear sirs,
    I am trying use one code for transfer some data from my C++ dll to my server(website) and return response from server to dll again.
    For example i send one serial number to server and server return another confirmation number to my dll.

    I am using below code and I can read data from my server by BOOL bRead = InternetReadFile(webResult, szwebBuffer, dwBytes, &dwBytesActual);

    i want know how I can send data to my server?
    Which function I can use?

    my code is same below:
    HINTERNET webHANDLE = InternetOpen(strTopic.c_str(), 0, "0", "0", 0);
    HINTERNET webResult = InternetOpenUrlA(webHANDLE, strHttpReq.c_str(), "0", 0, -2080374528, 0);
    if ( webResult )
    {
    char * szwebBuffer[1024];
    memset(szwebBuffer,0,sizeof(szwebBuffer));
    DWORD dwBytes = sizeof(szwebBuffer);
    DWORD dwBytesActual = 0;
    BOOL bRead = InternetReadFile(webResult, szwebBuffer, dwBytes, &dwBytesActual);
    InternetCloseHandle(webResult);
    gpVar->strAccNumber = (char*)szwebBuffer;
    }

    Thanks.

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: How send data to my server?

    It will depend on how the page is able to obtain those. For example, the data can be provided as GET parameters passed as a part of the URL.
    Best regards,
    Igor

  3. #3
    Join Date
    May 2010
    Posts
    38

    Re: How send data to my server?

    Dear Igor,
    Thank you for your response.
    I want send one number to my server.
    So I can send that by this: HINTERNET InternetOpenUrl(
    __in HINTERNET hInternet,
    __in LPCTSTR lpszUrl,
    __in LPCTSTR lpszHeaders,
    __in DWORD dwHeadersLength,
    __in DWORD dwFlags,
    __in DWORD_PTR dwContext
    );

    and using this LPCTSTR lpszHeaders, for sending my number?

    Thanks.

  4. #4
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: How send data to my server?

    What is the way the page allows to provide the data? If GET request is okay, lpszUrl will do for your purpose. I kinda repeat myself, don't you find that?
    Best regards,
    Igor

  5. #5
    Join Date
    May 2010
    Posts
    38

    Re: How send data to my server?

    Dear Igor,
    Thanks, I solved that.
    thanks Again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured