473,326 Members | 2,175 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

getsockname


Is there a C# equivalent to getsockname?

Or, what is the C# way of getting the port a socket is bound to if you allow
windows to pick the port for you?

--
Best Regards

"Failure is the opportunity to begin again more intelligently" – Henry Ford
Apr 2 '08 #1
2 3970
On Apr 2, 4:33 pm, David <Da...@discussions.microsoft.comwrote:
Is there a C# equivalent to getsockname?

Or, what is the C# way of getting the port a socket is bound to if you allow
windows to pick the port for you?

--
Best Regards

"Failure is the opportunity to begin again more intelligently" - Henry Ford
((IpEndPoint)TcpClient.Client.LocalEndPoint).Port
Apr 2 '08 #2

Thanks Ignacio
--
Best Regards

"Failure is the opportunity to begin again more intelligently" – Henry Ford
"Ignacio Machin ( .NET/ C# MVP )" wrote:
On Apr 2, 4:33 pm, David <Da...@discussions.microsoft.comwrote:
Is there a C# equivalent to getsockname?

Or, what is the C# way of getting the port a socket is bound to if you allow
windows to pick the port for you?

--
Best Regards

"Failure is the opportunity to begin again more intelligently" - Henry Ford

((IpEndPoint)TcpClient.Client.LocalEndPoint).Port
Apr 3 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Brad Tilley | last post by:
Instead of me arbitrarily assigning a high port number to a variable, is it possible to check for ports that are unused and then randomly assign one of them to a variable? Something like this is...
8
by: codecraig | last post by:
hi, how can i use python to figure the ip address of the machine which the python script is running on? I dont mean like 127.0.0.1....but i want the external IP address (such as ipconfig on...
8
by: Abhijit Bhadra | last post by:
Hi , I am using gcc version 3.3.2. While compiling this code struct sockaddr_in *CBaseSocket::GetSocketName() { socklen_t iLen; cCriticalSocket.Lock(); //...
7
by: Michi Henning | last post by:
Hi, I'm using a non-blocking connect to connect to a server. Works fine -- the server gets and accepts the connection. However, once the connection is established, I cannot retrieve either the...
0
by: Jason Jefferies | last post by:
I'm currently converting a number of applications written using the MFC in vc++ version 6 into a workable .NET solution. Just trying to build the apps in version 7 without worrying about...
3
by: Sells, Fred | last post by:
I'm using MSW XP Pro with Python 2.4 to develop but production will be Linux with Python 2.3. (could upgrade to 2.4 if absolutely necessary) I can also switch to Linux for development if...
13
by: Sandeep Singh | last post by:
I am making socket client application in C# how can i get ip address of client who has connected to server
14
by: Ankit Aneja | last post by:
The code of classes given below is for server to which clients connect i want to get ip address of client which has connected pls help how can i get //listen class public class listen {
13
by: 7stud | last post by:
I have the following two identical clients #test1.py:----------- import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) host = 'localhost' port = 5052 #server port
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.