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

  • SEARCH
  • Home
  • 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 6106219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:03:22+00:00 2026-05-23T14:03:22+00:00

Winsock 2, windows xp sp3. I have a socket, it was previously passed to

  • 0

Winsock 2, windows xp sp3.

I have a socket, it was previously passed to the bind() function, now I want to get this information from the socket.
More specifically, I want the port number that the socket was bound to.
All I have is the SOCKET instance.

How would I go about doing this?
The socket is UDP by the way.

My purpose is that I want to create a new raw UDP socket and build the ip header and udp header and tunnel information through the raw socket instead, but I don’t know what to put into the source port because I don’t know what it was bound to.

  • 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-05-23T14:03:23+00:00Added an answer on May 23, 2026 at 2:03 pm

    getsockname() should help you.

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

Sidebar

Related Questions

I`m writing client-server app for windows using WinSock and I have class for server.
I have a Winsock based server application which uses Windows Winsock I/O Completion Ports.
I have been getting this error for quite some time now and Google has
I have just started learning about socket programming and learned about winsock and achieved
Is there any benefit on Windows to use the WSA winsock functions compared to
Socket has a constructor that takes a winsock SOCKET as parameter and stores it
I'm porting some code from BSD sockets to Winsock, and I'm not sure how
On Windows, it's possible to program an LSP service on top of Winsock which
I have win32 application in which winsock is used for TCP/IP communication. I am
I have a driver which can be installed on Windows (XP/Vista/7). It's accessed via

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.