Hello !
I have some devices which communicate trough LAN to the server the old
form i was using was FTP as a communication between Server and Client i
have decided to use personal TCP sockets instead of using the FTP
protocol. Well im familar with sockets but some concepts im not able to
get it. I would be using Vb.Net as a server program but the question
pampering my brain is for eg .. ip 192.168.0.0.1 tries to communicate
on the server port 5444 and at the same time another device with ip
192.168.0.0.2 tries to communicate on port 5444 what would be the
result in this case the device with ip x.x.x.1 is still using the port
will the other device can communicate on the same port .
Regards
Altaf 10 1994
Don't you mean IP: 192.168.0.1 & not 192.168.0.0.1?
You can use one of the overloaded functions to pass a specific port number.
Just see the sockets class for information
Socket programming is greatly simplified with VB.NET
Crouchie1998
BA (HONS) MCP MCSE al************@ gmail.com wrote: Hello !
I have some devices which communicate trough LAN to the server the old form i was using was FTP as a communication between Server and Client i have decided to use personal TCP sockets instead of using the FTP protocol. Well im familar with sockets but some concepts im not able to get it. I would be using Vb.Net as a server program but the question pampering my brain is for eg .. ip 192.168.0.0.1 tries to communicate on the server port 5444 and at the same time another device with ip 192.168.0.0.2 tries to communicate on port 5444 what would be the result in this case the device with ip x.x.x.1 is still using the port will the other device can communicate on the same port .
Regards Altaf
This is the basic concept:
You use one port to make a connection (port 5444 in this case) then you
open a new port at a random port number (the framework will pick a port
for you) This new port is the one all the communication is done on,
leaving port 5444 for the next connection.
Chris This is the basic concept:
You use one port to make a connection (port 5444 in this case) then you open a new port at a random port number (the framework will pick a port for you) This new port is the one all the communication is done on, leaving port 5444 for the next connection.
Chris
Sorry, but I thought only UDP connections needs to release the public port
(5444 in this case), and create a random port for communication. Is the
socket for TCP and UDP connection works in same way?
Please point me out if I am wrong. Thanks.
Kai
Hello !
Thanks all for the reply....
Well i got the idea behind sockets more clearly....
Thanks once again.
> You use one port to make a connection (port 5444 in this case) then you open a new port at a random port number (the framework will pick a port for you) This new port is the one all the communication is done on, leaving port 5444 for the next connection.
I'm not convinced this is true actually, at least not for TCP sockets. If
this is the case, then a webserver listening on port 80 has to create a new
socket listening on a random port each time a client connects, which
produces obvious problems with firewalls & routers.
I was under the impression you created an array of socket objects, adding to
the array each time a new client connected, but all set to the same port (or
perhaps port 0?). I could be wrong as I don't do much socket coding...
Kind Regards,
Alex Clark
It doesn't pose a problem with firewalls & routers. I'm sure someone will
correct me if i'm wrong, but this is my experience with sockets.
Client calls server on listener port (SMTP port 25 perhaps)
Server responds with a random port assignment (maybe port 9999)
This causes the router/firewall to "open" port 9999 (maybe limit it to the
client's IP)
The client responds back on port 9999 and data exchange can commence.
The server resumes listening for new connections on port 25.
"Alex Clark" <ho*******@comm unity.nospam> wrote in message
news:Oy******** ******@TK2MSFTN GP12.phx.gbl... You use one port to make a connection (port 5444 in this case) then you open a new port at a random port number (the framework will pick a port for you) This new port is the one all the communication is done on, leaving port 5444 for the next connection.
I'm not convinced this is true actually, at least not for TCP sockets. If this is the case, then a webserver listening on port 80 has to create a new socket listening on a random port each time a client connects, which produces obvious problems with firewalls & routers.
I was under the impression you created an array of socket objects, adding to the array each time a new client connected, but all set to the same port (or perhaps port 0?). I could be wrong as I don't do much socket coding...
Kind Regards, Alex Clark
Hi, It doesn't pose a problem with firewalls & routers. I'm sure someone will correct me if i'm wrong, but this is my experience with sockets.
Client calls server on listener port (SMTP port 25 perhaps) Server responds with a random port assignment (maybe port 9999) This causes the router/firewall to "open" port 9999 (maybe limit it to the client's IP) The client responds back on port 9999 and data exchange can commence. The server resumes listening for new connections on port 25.
I'm 99% certain firewalls & routers do NOT work that way, it would pose a
pretty huge security risk if they were to open ports like that based on the
request of a service within the network.
The server itself likely remaps the established connection to either a
random port or a "pseudo" port (ie port 0) and then resumes listening on
port 25 in your example, otherwise the routers would potentially have large
arrays of open ports on them during busy times.
Regards,
Alex Clark
I can only go by what I observe watching incoming TCP connections to my BBS.
I am inside a router. The BBS listens on port 9999 (I have the router
configured to send 9999 to my BBS's internal IP). When a user logs in, the
status screens shows a user connected on some random port such as port
19837. I don't have that port opened up on my router, but the
communications are not interrupted.
If the server "remapped" the connection to a random port, wouldn't the
actual connection still be on port 9999? If so, how would anyone else be
able to connect? When I telnet out to another site, I telnet to a specific
port (23 for instance). Once the connection is established, my client
program tells me I am connected to some random port like 1029.
So from my observations, my explanation makes the best sense to me.
"Alex Clark" <ho*******@comm unity.nospam> wrote in message
news:uF******** ******@tk2msftn gp13.phx.gbl... Hi,
It doesn't pose a problem with firewalls & routers. I'm sure someone will correct me if i'm wrong, but this is my experience with sockets.
Client calls server on listener port (SMTP port 25 perhaps) Server responds with a random port assignment (maybe port 9999) This causes the router/firewall to "open" port 9999 (maybe limit it to the client's IP) The client responds back on port 9999 and data exchange can commence. The server resumes listening for new connections on port 25.
I'm 99% certain firewalls & routers do NOT work that way, it would pose a pretty huge security risk if they were to open ports like that based on the request of a service within the network.
The server itself likely remaps the established connection to either a random port or a "pseudo" port (ie port 0) and then resumes listening on port 25 in your example, otherwise the routers would potentially have large arrays of open ports on them during busy times.
Regards, Alex Clark
Hi Terry,
As I said, I'm certainly no socket expert! I think you're right with it
assigning to another random port - my experiences were from the "old" days
of VB6 Winsock programming. I believe once it's connected on the "true"
port, ie 25 for an SMTP server, the socket object referenced by handle is
then remapped to a new port number. Because it's already an established
TCP/IP connection, the router/firewall continues to let it through on the
new port.
Dang IP layer theories never did sit well with me, hehe!
Kind regards,
Alex Clark
"Terry Olsen" <to******@hotma il.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. I can only go by what I observe watching incoming TCP connections to my BBS. I am inside a router. The BBS listens on port 9999 (I have the router configured to send 9999 to my BBS's internal IP). When a user logs in, the status screens shows a user connected on some random port such as port 19837. I don't have that port opened up on my router, but the communicatio ns are not interrupted.
If the server "remapped" the connection to a random port, wouldn't the actual connection still be on port 9999? If so, how would anyone else be able to connect? When I telnet out to another site, I telnet to a specific port (23 for instance). Once the connection is established, my client program tells me I am connected to some random port like 1029.
So from my observations, my explanation makes the best sense to me.
"Alex Clark" <ho*******@comm unity.nospam> wrote in message news:uF******** ******@tk2msftn gp13.phx.gbl... Hi,
It doesn't pose a problem with firewalls & routers. I'm sure someone will correct me if i'm wrong, but this is my experience with sockets.
Client calls server on listener port (SMTP port 25 perhaps) Server responds with a random port assignment (maybe port 9999) This causes the router/firewall to "open" port 9999 (maybe limit it to the client's IP) The client responds back on port 9999 and data exchange can commence. The server resumes listening for new connections on port 25.
I'm 99% certain firewalls & routers do NOT work that way, it would pose a pretty huge security risk if they were to open ports like that based on the request of a service within the network.
The server itself likely remaps the established connection to either a random port or a "pseudo" port (ie port 0) and then resumes listening on port 25 in your example, otherwise the routers would potentially have large arrays of open ports on them during busy times.
Regards, Alex Clark
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Anatoly |
last post by:
In our application I need to detemine if there is a internet connection
valid.
So I build a windows service which every minute creates telnet connection
against some host and port.
If I do connect to this host I know that internet connection is OK.
The problem: after few days CPU usage growing up to 50% for this service.
After restart it's problem gone for another 2,3 days.
This is a code:
public static bool IsBrowseable(string IP, int...
|
by: Bonj |
last post by:
I've been following a socket programming tutorial to make a simple TCP
communication program, seemingly without hitches, it appears to work fine.
However the structure of it is to have a server listening for requests from
a client using listen(), and when one connects, it communicates with that
client but only that one. It doesn't listen for more requests.
What I'm wondering is can I have a server that continually listens for
requests...
|
by: Bonj |
last post by:
I've been following a socket programming tutorial to make a simple TCP
communication program, seemingly without hitches, it appears to work fine.
However the structure of it is to have a server listening for requests from
a client using listen(), and when one connects, it communicates with that
client but only that one. It doesn't listen for more requests.
What I'm wondering is can I have a server that continually listens for
requests...
|
by: J C |
last post by:
Hi,
I'm using UDPClient to make a simple DNS server. I notice that
intermittently and unpredictibly I get:
Unhandled Exception: System.Net.Sockets.SocketException: An existing
connection
was forcibly closed by the remote host
at System.Net.Sockets.Socket.ReceiveFrom(Byte buffer, Int32 offset,
Int32 s
|
by: Dan Ritchie |
last post by:
I've got a client/server app that I used to send large amounts of data via
UDP to the client. We use it in various scenarios, one of which includes
rendering a media file on the client as it is transferred via the underlying
UDP transport. In this scenario it is very important to keep CPU usage as
low as possible.
Both the client and server were originally written in C++, but I've
re-written the client in C#, partly to simplify it, but...
| |
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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.
| |