473,396 Members | 1,738 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,396 software developers and data experts.

Sockets, to be continued...

Hi,

Thanks all for you help with my "socket and buffer size" question.
I have decided to use async ones, and my code is working pretty well.

But i still have a non-answered question:

Is it a problem if all the client are connected and sending a large quantity
of bytes simultaneously to the same port of the server ?

In fact, each client is sending bytes (a value from 1 to 100 wich is the
result of an internal calculation) without any interruption to the server
(something like each second), which have to write out on a form the values
received from each client (represented as a slidebar graduated from 1 to 100
for each client for example)...

Somewhere on the net i saw that it's better to have one port by client, but
it sounds strange to me, indeed, i haven't seen any example like this ??!

Thanks again.
Mar 10 '06 #1
7 1408

"Steven" <no**@none.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
| Hi,
|
| Thanks all for you help with my "socket and buffer size" question.
| I have decided to use async ones, and my code is working pretty well.
|
| But i still have a non-answered question:
|
| Is it a problem if all the client are connected and sending a large
quantity
| of bytes simultaneously to the same port of the server ?
|
Not a problem, after all you only have a single wire don't you? The
framelevel (below IP) protocol arranges that only one client can send a
stream (1 up to framelength bytes) at a time.

| In fact, each client is sending bytes (a value from 1 to 100 wich is the
| result of an internal calculation) without any interruption to the server
| (something like each second), which have to write out on a form the values
| received from each client (represented as a slidebar graduated from 1 to
100
| for each client for example)...
|
| Somewhere on the net i saw that it's better to have one port by client,
but
| it sounds strange to me, indeed, i haven't seen any example like this ??!
|

What you read is BS, a port identifies a service, like port 25 which
identifies an SMTP service by convention. Multiple clients (thousands) will
use the same port to send their mail message to.
Probably, they (or you) are confusing sockets with ports.

Willy.
Mar 10 '06 #2
Hi,
I've encountered the same problem(?) when implementing async server.
I still don't know which way is better:
1. connect and transfer data on the same port.
2. connect on the same port and assign a unique port for data transfer.

It's true that this question is not relevant to the hardware level,
as there is only one wire.
But isn't there a potential bottle neck on the software level when using
the same port for data transfer?
Sharon.
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:u4**************@TK2MSFTNGP14.phx.gbl...

"Steven" <no**@none.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
| Hi,
|
| Thanks all for you help with my "socket and buffer size" question.
| I have decided to use async ones, and my code is working pretty well.
|
| But i still have a non-answered question:
|
| Is it a problem if all the client are connected and sending a large
quantity
| of bytes simultaneously to the same port of the server ?
|
Not a problem, after all you only have a single wire don't you? The
framelevel (below IP) protocol arranges that only one client can send a
stream (1 up to framelength bytes) at a time.

| In fact, each client is sending bytes (a value from 1 to 100 wich is the
| result of an internal calculation) without any interruption to the
server
| (something like each second), which have to write out on a form the
values
| received from each client (represented as a slidebar graduated from 1 to
100
| for each client for example)...
|
| Somewhere on the net i saw that it's better to have one port by client,
but
| it sounds strange to me, indeed, i haven't seen any example like this
??!
|

What you read is BS, a port identifies a service, like port 25 which
identifies an SMTP service by convention. Multiple clients (thousands)
will
use the same port to send their mail message to.
Probably, they (or you) are confusing sockets with ports.

Willy.

Mar 10 '06 #3
Hmm.. are you sure you aren't confusing ports with sockets?
A server listens on a port (actually it binds a socket to a port), when a
connection request arrives at that port, you duplicate the socket and go
back to listen for new connection requests, while you use the duplicated
socket to handle the actual data transfer.

Willy.

"Sharon" <no*****@null.void> wrote in message
news:Ov**************@TK2MSFTNGP12.phx.gbl...
| Hi,
| I've encountered the same problem(?) when implementing async server.
| I still don't know which way is better:
| 1. connect and transfer data on the same port.
| 2. connect on the same port and assign a unique port for data transfer.
|
| It's true that this question is not relevant to the hardware level,
| as there is only one wire.
| But isn't there a potential bottle neck on the software level when using
| the same port for data transfer?
| Sharon.
|
|
| "Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
| news:u4**************@TK2MSFTNGP14.phx.gbl...
| >
| > "Steven" <no**@none.com> wrote in message
| > news:%2****************@TK2MSFTNGP14.phx.gbl...
| > | Hi,
| > |
| > | Thanks all for you help with my "socket and buffer size" question.
| > | I have decided to use async ones, and my code is working pretty well.
| > |
| > | But i still have a non-answered question:
| > |
| > | Is it a problem if all the client are connected and sending a large
| > quantity
| > | of bytes simultaneously to the same port of the server ?
| > |
| > Not a problem, after all you only have a single wire don't you? The
| > framelevel (below IP) protocol arranges that only one client can send a
| > stream (1 up to framelength bytes) at a time.
| >
| > | In fact, each client is sending bytes (a value from 1 to 100 wich is
the
| > | result of an internal calculation) without any interruption to the
| > server
| > | (something like each second), which have to write out on a form the
| > values
| > | received from each client (represented as a slidebar graduated from 1
to
| > 100
| > | for each client for example)...
| > |
| > | Somewhere on the net i saw that it's better to have one port by
client,
| > but
| > | it sounds strange to me, indeed, i haven't seen any example like this
| > ??!
| > |
| >
| > What you read is BS, a port identifies a service, like port 25 which
| > identifies an SMTP service by convention. Multiple clients (thousands)
| > will
| > use the same port to send their mail message to.
| > Probably, they (or you) are confusing sockets with ports.
| >
| > Willy.
| >
| >
|
|
Mar 10 '06 #4
Hi again Willy !

I'm not sure of what you're calling "wire", but the server is also sending
datas to the client, but only to the "selected" one.

Indeed, i have some clients (max 50) sending bytes (approx 600 bytes)
simultanously to the same port of the server, and the server is answering to
only one selected client, also via the same port.

Is this configuration correct ? Like Sharon asks (his english is much better
than mine !!) : "Isn't there a potential bottle neck on the software level
when using the same port for data transfer?"

Thanks !
Mar 10 '06 #5
"Steven" <no**@none.com> wrote:
Is it a problem if all the client are connected and sending a large
quantity of bytes simultaneously to the same port of the server ?
That's just fine. In fact, any other way would be wrong.

Just as long as each client has done a connect to the port, and has it's own
socket, you're fine.

Let's say you had "MagicService" listening on port 555. You then have 100
clients connect to this port and start sending data. In your server, you'll
have a collection of 100 sockets, each of which works exactly the way you
think it would.
Somewhere on the net i saw that it's better to have one port by client,
but it sounds strange to me, indeed, i haven't seen any example like this
??!


Whoever said that was.... wrong.

--
Chris Mullins
Mar 10 '06 #6
"Steven" <no**@none.com> wrote
"Isn't there a potential bottle neck on the software level when using the
same port for data transfer?"


Nope, no problem at all. This is how TCP is supposed to work.

You listen on a port, accept incoming connections on that port, then send
and receive data to and from the client over that socket.

This method scales wel into the tens of thousands of simultanious connected
sockets...

--
Chris Mullins
Mar 10 '06 #7

"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:u4**************@TK2MSFTNGP14.phx.gbl...

"Steven" <no**@none.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
| Hi,
|
| Thanks all for you help with my "socket and buffer size" question.
| I have decided to use async ones, and my code is working pretty well.
|
| But i still have a non-answered question:
|
| Is it a problem if all the client are connected and sending a large
quantity
| of bytes simultaneously to the same port of the server ?


There is a whole lot of misunderstanding going on here:

1. a port is just a number. It is not a port in the same sense as COM1 say
where you have a singular physical connection.
2. A logical TCP connection is a 4-tuple (client addr,client port,server
addr,server port) It is IMPOSSIBLE for there to be duplicates because the
client cannot attach the a port on its machine more than once.
3. The only physical port is the ethernet adapter. You will normally only
have one but you can add more in which case you will have more than one IP
address. The port numbers on the adapters are unrelated in any way.
4. Listening for connections is potentially a bottle neck since typically
only one thread can listen (I'm not sure that this is true for .NET but it
is for many implementations) but this only relates to connectuion NOT to
subsequent data transfer which will normally be done on different threads.
5. The result of all this is that it makes no difference whether the clients
connect to the same port or different ports.
Mar 11 '06 #8

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

Similar topics

2
by: Tero Saarni | last post by:
Hi, I have several threads communicating with each other using events stored in Queues. Threads block on Queue.get() until somebody publishes an event in thread's event queue. I need to add...
0
by: Nunya Biznas | last post by:
I have a two column report that needs to have the word "continued" appear at the top of the 2nd column if the detail records are part of the group from the previous column. I have tried using a...
4
by: BadOmen | last post by:
Hi, What is the different between 'System.Net.Sockets.Socket' and 'System.Net.Sockets.TcpClient'? When do I use System.Net.Sockets.TcpClient and System.Net.Sockets.Socket?? Yours, Jonas
3
by: Michael Maercker | last post by:
hi! i'm really not into networking at all and have now been asigned the task of porting a vb6-code into vb.net (compact framework, in this case) and the code uses the winsock-control. i quickly...
4
by: andreas.w.h.k. :-\) | last post by:
How do I change the address location in the wsdl <wsdl:port name="SearchSoap12" binding="tns:SearchSoap12"> <soap12:address location="http://searchservices/engine/search.asmx" /> </wsdl:port> ...
3
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...
13
by: Alexander Gnauck | last post by:
Hello, while using async sockets I ran into a strange problem which occurs only on some machines. I wrote a small demo application which can be used to reproduce the problem. You can download it...
7
by: Adam01 | last post by:
Im using cygwin to test the code of a server I am writing. I've included sys/types.h, sys/socket.h, netdb.h, and arpa/inet.h. And this is the output.. ../../../sockets.cpp: In constructor...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
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,...
0
jinu1996
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...
0
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...
0
tracyyun
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...
0
agi2029
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,...

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.