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 8888321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:00:07+00:00 2026-06-14T22:00:07+00:00

I learn now about sockets and I saw that there is two struct Sockaddr

  • 0

I learn now about sockets and I saw that there is two struct
Sockaddr and sockaddrin.

The guide say to include char with 8 character in the struct to compare one struct to another I dont understand how its work can you explain me?

Its like cast int to char[2]?

How its working with structs?

Thank you.

  • 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-14T22:00:09+00:00Added an answer on June 14, 2026 at 10:00 pm

    SOCKADDR is a generic structure that contains an ADDRESS_FAMILY field and then 14 bytes (of type char) after that field. Depending on the value of the sin_family field (the ADDRESS_FAMILY), the 14 bytes that follow would be interpreted differently.

    When the sin_family value equals AF_INET, then the SOCKADDR structure is really a SOCKADDR_IN structure, which just means that the 14 bytes really should be interpreted as:

    2 bytes for sin_port
    4 bytes for sin_addr
    8 bytes of padding that aren’t used but have to be there to make it be the same size as a SOCKADDR structure.

    So if you had a pointer to SOCKADDR, and you inspected the sin_family field and it equaled AF_INET, then you could cast your pointer to a pointer to SOCKADDR_IN and access the fields that way.

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

Sidebar

Related Questions

I'm about halfway through Javascript the Definitive guide and realize now that a primary
I learn now about sockets and I find it very confusing because the casting
I just started to learn about mod rewrite process. Now, I got some problems
Ok guys, I started to learn more about Jquery and now I could make
I am coming from Java and try to learn Javascript right now. Doing that
I'm attempting to learn a little more about handling sockets and network connections in
I've been reading things here and there for a while now about using an
In my attempt to learn core JavaScript, I am now learning about EventListeners. My
I've been trying to learn about Neural Networks for a while now, and I
i am interested to learn more about spacing, offset, and stuff that applies to

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.