Multiple servers...

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Multiple servers...

2,102 次查看
SKumar
Contributor I
Hi all,
 
          I am using MCF52235EVB borad.
           I am building application on codewrrior enviornment on c language.
 
          I have implemented applcation with single server multiple listeners listening for request.
         Now i want to have mutliple servers running on board with differnt IP.
          
           Is it at all possible?
          If yes how do i start..
 
         
 
 
Thanks,
kumar.
标签 (1)
0 项奖励
4 回复数

460 次查看
SKumar
Contributor I
Thanks a lot.. that is great help for me...
 
Regards,
Sushil
0 项奖励

460 次查看
Kremer
Contributor I
I don´t think multiple IP´s on the same physical interface could be possible.
0 项奖励

460 次查看
mccPaul
Contributor I


Kremer wrote:
I don´t think multiple IP´s on the same physical interface could be possible.



Multiple IP addresses are possible if the TCP/IP stack supports it. If you think about it, all the stack has to do is to make sure that its ARP implementation replies with a MAC address when a request for any of the assigned IP addresses is received. That means that the remote host can then send IP packets to the correct MAC address on the network.
 
The way ARP works is that I broadcast a request containing the IP address that I am trying to connect to. My multiple IP address implementation receives the broadcast request and matches the requested address against a list of addresses for the interface. If a match is found, I send an ARP reply with the MAC address of the interface. (Here you may realise that you could have multiple MAC addresses also, as long as your Ethernet hardware supports multiple MAC addresses or some kind of promiscuous mode...).
 
Then the remote host sends an IP packet to my MAC address and my Ethernet driver simply passes the packet to the IP protocol stack.
 
If my multiple IP address implementation is trying to connect to another host, it needs some logic to try and choose the most sensible IP address to use in its own ARP requests. This is typically the first address in the list, or the first in the list on the same subnet as the host I am trying to connect to.
 
With a simple stack, this isn't too hard to implement because ARP is a very simple protocol. If it isn't already implemented in your OS/stack you will need to make some changes to the ARP implementation and probably also to the way that TCP sockets are bound to a particular local IP address (or you may find that your stack and the remote stack disagree about the address of your interface.
 
Paul.
 
0 项奖励

460 次查看
Kremer
Contributor I
 Hi Paul
 
 I didn´t realized this, but the way you wrote is perfectly doable. Indeed it would require some efforts on the stack so. But maybe another time, for now i have plenty work to do :smileywink:
 
Cheers
0 项奖励