Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 07-10-2016, 03:27 AM
lexd lexd is offline
Senior Member
 
Join Date: Feb 2015
Posts: 268
Default Set up A TCP Server

I want to setup TCP servers for the same task (using Delphi's TcpClient & TcpServer).
I have a memory block that has everything in it. I could add the client IP address into the memory block, if I could get it. And I need to return a new memory block from the server computer back to the client. This requires all computers to have clients and servers and operate 2 socket addresses.
I'm thinking ethernet is about 1/10th of Ethernet speed, that is quite good on 1 gig data rate (near instant for 500kb).

1/ local-area Network: -
Like most local area Networks you have a DHCP server that allocates IPv4 addresses out to a local area Network.
a) I have a server set to a socket address example 165, 192, 0, ?:105; how do I find the server using a client TCP at start up. Do I have to run my own ping system that returns my server ID back to the client.
3/ I have more than one client supplying the server, how do I separate clients and send data back.
4/ blocking/nonblocking issues and the server computer running threads..............

I also what to do the same thing from a web address 'www.foo_site.com' but see no problem finding the server.
But have questions like speed and blocking/nonblocking issues.

Am I thinking write, as I have not done this before.

Last edited by lexd; 07-11-2016 at 11:54 AM.
Reply With Quote
  #2  
Old 07-11-2016, 09:55 AM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,333
Default

I really have no clue on what you just wrote.

Quote:
I want to setup two TCP servers for the same task
Why???
Now you'll have to build client logic to talk to serverA or serverB (which do the same thing). This is server logic, definately not client logic.
You obviously search for a solution to a problem you have. I doubt this is the correct solution, but for that I'll need more info on what it does/it's purpose.

So what do you want/have, the default demo chat-app?
Or perhaps a Soap or Rest server?

Let me refrase, what is the purpose of the server?
Because you cannot transfer a memory pointer from server to client, you'll have to translate it into something else (json/xml/???)
And this will also affect speed...

Quote:
1/ local-area Network: -
Like most local area Networks you have a DHCP server that allocates IPv4 addresses out to a local area Network.
a) I have a server set to a socket address example 165, 192, 0, ?:105; how do I find the server using a client TCP at start up. Do I have to run my own ping system that returns my server ID back to the client.
3/ I have more than one client supplying the server, how do I separate clients and send data back.
4/ blocking/nonblocking issues and the server computer running threads..............
1) ??? what is the question here ???
a) Server is configured in your client, what would you ping to get this back?
I'm also nog a big fan of the IP convention, I suggest my customers a DNS (but I use the Soap/Rest variant)
3) A server is multi-threaded. This is all handled for you in the Soap/Rest (at least I have never had to write any code for this). If you use the demo chat-app you'll probably have to write the tasks in threads, but that's not that hard either.
4) ??? what is the question here ???

As long as the client requests data from the server your best approach would be the Soap or Rest server.

If you want bi-directional (my idea is that only a notification system like a chat-app has need for this) you should take a look at the demo chat-app. All your questions are answered there.

As for the speed question, it depends on several factors. So there's no answer that could be given there.

So my advise, first figure out what you want. Build a small test for your needs. Test speed with large amounts of data and see if it fits your requirments.
But speed is mostly the data that travels over the line, so the input/output of the method. But that all depends on your requirments...
Reply With Quote
  #3  
Old 07-11-2016, 11:53 AM
lexd lexd is offline
Senior Member
 
Join Date: Feb 2015
Posts: 268
Default

Another way to explain this is the internet/DHCP server combined through the modem is a server to its LAN computers. still using the DHCP server. Now I want to make one computer through two port numbers a server for my software, but dependant on IP addresses for client computers to find the server computer. May be I should ask what you do understand of my question.

Last edited by lexd; 07-11-2016 at 12:10 PM.
Reply With Quote
  #4  
Old 07-11-2016, 12:44 PM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,333
Default

Quote:
May be I should ask what you do understand of my question
Sorry, but absolutely nothing

I cannot see why you need multiple servers on different ports that have the same codebase. Seems like a very ugly way of making something multithreaded.

Quote:
but dependant on IP addresses for client computers to find the server computer
Why does this server need a mapping of ip-addresses. What is so important that clientA needs serverA and clientB needs clientB if they do the same?

And your client communicates with a server, how can it communicate if it doesn't know which one it should communicate to?
Reply With Quote
Reply

Tags
delphi

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 05:08 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.