Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9162131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:08:25+00:00 2026-06-17T14:08:25+00:00

when I try to connect to my server, my client fails during the function

  • 0

when I try to connect to my server, my client fails during the function WSAStringToAddress with the error 10022, I think the problem is that I try to get the IPv6 address from a console argument. The format of the console argument is ::1 for my localhost address.

Here is the function that fails:

WSAStringToAddress((LPWSTR)argv[1], AF_INET6, NULL, (SOCKADDR *)&server, &len)

And here code for the server and len variables:

struct sockaddr_in6 server;
int len = sizeof(server);
memset( &server, 0, sizeof (server));
server.sin6_family = AF_INET6;
server.sin6_port = htons(PORT);

Yeah I hope someone sees the mistake I made.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T14:08:25+00:00Added an answer on June 17, 2026 at 2:08 pm

    Error 10022 is WSAEINVAL, which means you passed an invalid parameter. The problem in this case is that when compiling a Unicode program, WSAStringToAddress takes a wide-character string, and you’re passing it a narrow string cast to a wide string. The compiler error you were getting before you inserted the cast should have raised a red flag.

    You have a few options:

    • Change your application to be non-Unicode (not recommended)
    • Change your main function to be wmain instead, which takes wide-character argument strings
    • Explicitly use the narrow (ANSI) version by calling WSAStringToAddressA instead of WSAStringToAddress
    • Convert the string from narrow to wide using MultiByteToWideChar

    In this particular case, I’d recommend explicitly using the WSAStringToAddressA function, since using the wide-character version doesn’t afford any extra advantage for this function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a client and server that connect to each other. The server is
First I unplug my network cable. Then I try to connect to SQL Server
When I try to connect Weblogic t3s protocol in Solaris Server, it shows this
I am trying to connect to my TFS 2010 RC server. When I try
I have the following basic server/client java code, that works when server and client
Our software needs to connect to an server and we do that with use
I've written a client that connects to a server via a named pipe, and
When I try to connect to the sql server using the sqlcmd utility, I
When I try to connect to the sql server using the sqlcmd utility, I
Everything I try and connect to via https fails. Bellow is a curl output,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.