In a TCP/IP style network you have:
the network layer = typically ethernet, but can be anything.
IP = protocol for addressing machines without needing the ethernet address. It also contains a payload.(IP address and Port # are for this layer, this layer makes it possible for a machine on a ethernet to talk to a machine on a Token Ring. Both don't speak the same network layer protocol, but both speak IP.)
TCP = protocol for managing data packets. sits in the IP payload. used to ensure data transmitted is received. If a packet takes 1 mintue to get to you then your data stream delays for a minute
application = the program consuming TCP stuff.
Does your TV understand TCP either?
You don't HAVE to use IP to transmit TCP, but you will need to write something to replace its functionality. That's a lot lower level than you'd want to go. TCP has no addressing capability.
IP Exchange:
hey, I have an IP packet.
let me look in my ARP table to see if I know the raw address of the inteded machine.
yes - send the packet to the machine
no - okay need to check my routing table and see where it is
is the machine's direct address in my routing table
yes - send the data to the gateway of that machine (could be a router or that machine)
no - look for a newtwork entry matching that machine's subnet.
did I find one
yes - send to the indicated gateway of that subnet (almost always a router)
if no entry in the routing table exist then send to my default gateway and let it worry about where the packet goes next.
(note: all gateway look ups will requre a arp lookup. a cache is maintained to reduce the overhead of doing this. ARP is a broadcast to all machines on a network saying "who has this IP". Thus ALL machines on the network have to process tha ARP packet and see if its inteded for them.)
See what I mean, I probably don't have it all correct either. And there's a lot more to it too. For example what if the wire between two machines is broken and an alternate route exist. ICMP takes care of this and will also need to be reimplemented.
What are you trying to do with your TV?
> What are you trying to do with your TV?
It is not my TV I want to communicate with :) that was the first thing that crossed my mind while thinking of something electronical that definitly did not support TCP :)
> The answer to the OP is 'Yes'.
Thanks, I just wanted to make sure of that :) Was thinking of creating a chat application that could transmit text on different communication channels (TCP, BlueTooth, etc). However it seems impossible to do this using only the Sockets API.
Guess the only solution is to encapsulate such connections into a general API understood by my application and then use that one right? like that my application can actually not bother about the connection itself and only handles the chatting part!
Regards,
Sim085
> This is one of those moments in life were I'm feeling
> totally ignored :(
>
> Regards,
> Sim085 :)
Well, to help with your feeling, I believe your API idea is a good one. I made a chat application in much the same manner. The Chat Application and the (I'll say it this way) Communication Application communicated using a send and receive queue, and the Communication part simply needed a Class that implemented a "plug-in kick-off interface". Essentially an abstract class with a constructor that took two "Queue" interface parameters and implemented Runnable.
With a slight modification on the idea, you could have multiple communication "applications/layers" reading from and adding to the queues to allow you simultaneous communication over varying protocols.
What do you think of that idea?
Why would I post without being 100% correct:
Just trying to point out at a high level that if you use something else to move the TCP then you'll eventually have to implement the functionality that IP gives you.
To those that insist that you HAVE to use IP to move TCP, the answer to that is NO! That's like saying that IP has to use Ethernet. You don't. All IP provides is addressing and routing.
An example of an IP alternative is TULIP: http://www.techiwarehouse.com/cms/engine.php?page_id=2b7e10ac
A network diagram that uses TCP and NO IP:
http://citeseer.ist.psu.edu/cache/papers/cs/4058/ftp:zSzzSzpaul.rutgers.eduzSzpubzSzbadrizSzitcp-tr314.pdf/bakre95itcp.pdf#page=5
(ejb, please refer to your own post about misinformation.)
The port is in the TCP layer. Sorry, wasn't thinking there. Actually what I was thinking about is how more expensive NICs can decide if it should look past the IP header of a packet. By being able to ignore IP addresses it is not assigned it can save CPU time.Checking to see if it should listen to a port would be cool too, but that would take too much. A machine will only have a few IP addresses (at least one in the class A,B,C range, maybe a multicast address, at least one broadcast address) which wouldn't take much to store in the NIC. Listening to 1000s of ports is not unheard of.
For the author:
I'd design your chat program with two basic interfaces in mind. There will be guaranteed delivery and best effort. TCP gives you a grantee that either the packet gets to the receiving station or the sender gets an error. That's great until you want to talk Bluetooth.
Bluetooth, IR, and Serial comms are all basically the same in the WinTel world. You talk to them over a COMM port. Here you have no guarantee of delivery. Thus in the old days of downloading you had to use a protocol like ZModem to transmit files and make sure you got them all.
You'll need to implement you own guarantee of delivery for these. Basically look into what TCP provides and implement something similar with Java. Checksum, sequence number, and acks.
When you implement your chat, part of your own "network stack" would decide if it needed to transmit service guarantee information with the data at the application level or not. There is no point in incurring the overhead if TCP is being used.
UDP may work, but I don't trust it past a LAN. Some UDP packets will always be dropped by a router. One example is broadcast packets. I doubt any admins will let a broadcast come into their router. Also, because viruses propagate by broadcasting, a lot of admins may limit them to the subnet of the host. UPD is real good for streaming audio. Something when if you lose a packet you don抰 want to recover it. If you抮e listening to a game on the radio and there is a lightning strike. Would you rather hear the pop and still be in sync with the broadcast or do you want to fall a second or two behind 搇ive?coverage?I think that UPD packets are more readily dropped by a congested router. That's working on the theory that "If the application doesn't care about the packet really getting there (it would have used TCP) then why should I when I'm too busy."
You wrote:
> See what I mean, I probably don't have it all correct either
> Why would I post without being 100% correct:
I was reacting to the first of these (mutually inconsistent) statements. It's a legitimate activity. We all make mistakes when posting: the important thing is that what's finally left in the thread is correct.
> To those that insist that you HAVE to use IP to move
> TCP, the answer to that is NO! That's like saying
> that IP has to use Ethernet.
No it isn't like saying that at all (not that anybody said it). There is no definition of TCP or IP that says it has to be over Ethernet, and there is no definition of TCP that doesn't say it operates over IP. You can implement something that looks a bit like TCP and you can call it TCP if you like but that doesn't make it TCP. It's not a question of 'those who insist that you HAVE to use IP', it's simply that there is no other meaning of TCP.
> You don't. All IP provides is addressing and routing.
TCP also relies on the packet reassembly present in the IP layer. It also relies on ICMP error conditions.
Your citations are not germane. The 'network diagram that uses TCP and NO IP' that you cited is clearly labelled 'I-TCP' which is clearly something similar to but also distinct from TCP, as the text on the same page makes quite clear. TULIP is described on the other page you cited as a link layer protocol, where (in these defunct OSI terms) IP is a network layer protocol. It also says on that page that 'TULIP lies between the MAC layer and theTCP/IP layer.' Not 'an example of an IP alternative' at all. No doubt there really are 'IP alternatives', and implementations of TCP that don't rely on IP but without IP it can't possibly be TCP as defined in the RFCs; it must be something similar-but-different. Just as I-TCP is.