I am writing a simple client using UDP sockets.
I am wondering if there is any way to determine what local port a
socket was bound to when bind() is not explicitly called.
This is what my program looks like:
sock = socket(PF_INET, SOCK_DGRAM, 0);
sendto(sock, message, strlen(message) + 1, 0, (struct sockaddr *)
&server, sizeof(server)) ;
Note that bind() was not called, and the socket was arbitrarily(?)
bound to a local port by the kernel. How do I determine what port it
was bound to?
Thanks.
Anket Mathur 4 1826 an****@gmail.co m writes: I am writing a simple client using UDP sockets.
Standard C doesn't support UDP sockets, or any kind of networking.
Try a newsgroup specific your system, (possibly comp.unix.progr ammer).
--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this. an****@gmail.co m wrote: I am writing a simple client using UDP sockets. I am wondering if there is any way to determine what local port a socket was bound to when bind() is not explicitly called.
This is what my program looks like:
sock = socket(PF_INET, SOCK_DGRAM, 0); sendto(sock, message, strlen(message) + 1, 0, (struct sockaddr *) &server, sizeof(server)) ;
Note that bind() was not called, and the socket was arbitrarily(?) bound to a local port by the kernel. How do I determine what port it was bound to?
This is all off topic here. See the references in my sig below,
especially the first two.
--
Some useful references about C:
<http://www.ungerhu.com/jxh/clc.welcome.txt >
<http://benpfaff.org/writings/clc/off-topic.html>
<http://www.eskimo.com/~scs/C-faq/top.html>
<http://anubis.dkuug.dk/jtc1/sc22/wg14/www/docs/n869/> (C99)
<http://www.dinkumware. com/refxc.html> (C-library}
<http://gcc.gnu.org/onlinedocs/> (GNU docs) an****@gmail.co m wrote: I am writing a simple client using UDP sockets. I am wondering if there is any way to determine what local port a socket was bound to when bind() is not explicitly called.
The local Port is Taylor's Ten-Year-Old Tawny. The
well-known Ports include Graham's 1977 and Taylor's 1983.
The reserved Port is the Fonseca 1963, the limited (alas!)
supply of Taylor 1948 having been exhausted.
--
Eric Sosman es*****@acm-dot-org.invalid
Eric Sosman wrote: an****@gmail.co m wrote:
I am writing a simple client using UDP sockets. I am wondering if there is any way to determine what local port a socket was bound to when bind() is not explicitly called.
The local Port is Taylor's Ten-Year-Old Tawny. The well-known Ports include Graham's 1977 and Taylor's 1983. The reserved Port is the Fonseca 1963, the limited (alas!) supply of Taylor 1948 having been exhausted.
So have some Madiera, m'dear :-)
--
Some useful references about C:
<http://www.ungerhu.com/jxh/clc.welcome.txt >
<http://www.eskimo.com/~scs/C-faq/top.html>
<http://benpfaff.org/writings/clc/off-topic.html>
<http://anubis.dkuug.dk/jtc1/sc22/wg14/www/docs/n869/> (C99)
<http://www.dinkumware. com/refxc.html> (C-library}
<http://gcc.gnu.org/onlinedocs/> (GNU docs) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Keith Langer |
last post by:
I have a TCPListener which needs to listen on my LAN IP as well as the
loopback address. In VS.Net 2002 the TCPListener constructor could
accept the port as an argument and it automatically bound to all
network adapters (this is also how it worked with VB6). Now that
constructor is obsolete, and the new one requires an IPEndPoint or
IPAddress.
How could I listen on the same port on all network adapters using
VS.Net 2003? I'd rather...
|
by: jiing |
last post by:
Now let me describe what I have done and my purpose:
Originally, I want to user ports to install phpBB
But I found that phpBB doesn't support mysql 5.x (but the ports
installed mySQL 5.0.0 alpha)
so I deinstall mysql5-server and mysql5-client
And then I install mysql41-server and mysql41-client on FreeBSD 5.3 by
ports
but now , mysql is not workable
|
by: John Morgan |
last post by:
I have Enterprise Manager on my local machine. For the last twelve
months it has been connecting without problem to my online SQL Server
database provided by my ISP.
Three weeks ago the ISP applied some sort of extra security
arrangements to their SQL Server to allow access only through port
1433. they have told me to configure an alias using Network Client and
to register this alias in the usual way using my Enterprise Manager.
My...
|
by: Gregory Hassett |
last post by:
Hello,
I want to periodically send a TCP packet to a peer, always from the same
source port. That is, each packet will come from my local ip address, port
8801, and go to the peer's ip address, to HIS port 8801.
This means that I need to bind my sender socket to (myaddress,8801), use it
for the send, then shut it down and close it. Then I want to wait, say 30
seconds, and do it all over again. Naturally, the socket's ReuseAddress...
|
by: Jm |
last post by:
Hi All
Is it possible to determine who is logged onto a machine from inside a
service using code in vb.net ? I have found some code that seems to work
under vb6, but doesnt under .NET ? Any help is greatly appreciated
Thanks
| |
by: orp |
last post by:
We've been struggling on how to determine if a local user is already in a
local group. We have code (C#) that creates a local user, if the user
doesn't already exist. And, we have code (C#) that creates a local group,
if the group doesn't already exist. Both of these work fine.
Now, we need to check whether the local user is already in the local group
or not. We have code (C#) that adds the local user to the local group, but
we...
|
by: ljlevend2 |
last post by:
Is there any way to create a local server during runtime? For example, if
you add an existing Web Site to a Solution from within Visual Studio (by
right clicking the solution in the Solution Explorer, then selecting Add -
Existing Web Site...), then Visual Studio will create an ASP.NET Development
Server on a random port (e.g., http://localhost:1619/Test). Can a similar
thing be done during runtime with VB.NET? If not, is it possible to...
|
by: LongBow |
last post by:
Hello,
Is there a way, in .NET, to determine what are the avialable Serial
(Communications) Ports on a Windows OS and is there a way to determine
that port isn't being use other than attempting to opening the Serial
Port and catching the associated exception? Thanks
If there isn't a way to determine the Serial Port within .NET I would
be willing, I guess, to use a WinAPI is that was the only way.
|
by: jcprince |
last post by:
Hi
Not sure I can do what I'm trying to do without using a 3rd party
component like Dart. I need to build a windows service to create a
socket connection on an IBM mainframe using an IP and port
combination. No problem there.
However, due to the expected volume (at least 20x10K streams per
second in each direction), the mainframe sysadmin has requested the
service use multiple 'conversations' within the single IP connection.
The...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |