Networks - alternative to sockets?

  • Thread starter LM741
  • Start date
  • Tags
    Networks
In summary: TCP is handed by the OS. I remember things like the TCP window size, congestion avoidance, etc..., and i don't see the NIC doing these things. At least early TCP implementations weren't on the NIC i bet. You are correct, early TCP implementations weren't on the NICs. The NICs would only receive and send IP packets. However, with the introduction of TCP/IP, the NICs started to support the transport layer and started to provide support for other protocols such as ports and sockets.
  • #1
LM741
130
0
Hey guys just nusy writing out a server and client program in Java.
i use sockets to transfer data from one program to another..

just wanted to know if there is an alternative to newtorked communication between client and server apart from using sockets.


also ...where do sockets fit in the OSI 7 model layer...?

thanks

John
 
Computer science news on Phys.org
  • #2
Layer 4, is where ports/sockets fit in the osi model. Although IP doesn't fit directly to the osi model, tcp sits at the transport layer (also udp and rtp).

7=application
6=presentation
5=session
4=transport
3=network
2=data
1=physical

There are lots of protocols you could write code to use, one is actually osi, the only problem with using a different protocol is that the client and server would have to understand these protocols, ie have the protocol stack loaded on the nic of the two stations.
 
  • #3
Anttech>>thanks - still slightly confused about your last statement...is this an alternative to using sockets?
thanks
 
  • #4
Sockets/Ports are used by TCP/UDP sessions. Which is part of the IP protocol stack. So if you do not want to issue service requests to the network layer using ports, you will have to use a different protocol than IP. Such as OSI, or DECnet. But if you want to use a different networking protocol as your communications channel the client and server will have to be able to understand that protocol.
 
  • #5
Ports and sockets are implemented by the Operating System. Sockets are an interface provided by the OS and ports are used to address an application. All of the communication sent through the sockets is eventually sent via TCP or UDP, over IP.
Network Communication without the use of Ports can't use the common TCP or UDP transports since these protocols require, besides an IP address, a Port number, used to identify the application to which to deliver the data, but i don't see why you can't use IP (Anttech, why?).
The IP packet's header contains only source/destination IPs, options, data, and fields such as TTL, Checksum, flags, etc.
Possibly then you might create your own transport protocol, "ADP". This protocol uses some form to address applications, other than port number, and you provide the Operating System with an interface for sending and receiving ADP/IP packets.
When sending data over the network your Operating System would place the data in an ADP packet and place the packet in the data field of one or more IP frames which would be moved down and onto the end host.
The problem that i see would be packaging/unpackaging of packets which is not a problem as long as you use IP. I think that TCP/UDP packaging is done by the OS.
 
Last edited:
  • #6
Ports and sockets are implemented by the Operating System. Sockets are an interface provided by the OS and ports are used to address an application. All of the communication sent through the sockets is eventually sent via TCP or UDP, over IP.
Network Communication without the use of Ports can't use the common TCP or UDP transports since these protocols require, besides an IP address, a Port number, used to identify the application to which to deliver the data, but i don't see why you can't use IP (Anttech, why?).
Well you can, if you want to use a different transport layer protocol, but AFAIK only tcp and udp are implemented as the defacto standard on servers and clients as the transport layer protocol within the IP stack.
Possibly then you might create your own transport protocol, "ADP". This protocol uses some form to address applications, other than port number, and you provide the Operating System with an interface for sending and receiving ADP/IP packets.
Sure, if you really want to you can create your own layer 4 transport protocol. Consequently you will have to also write your app with this in mind, and probably you will have to write your own protocol stack from the Application layer down to your new protocol sitting on top of IP. To add to this your would have to then Hard write this new protocol to your network card so the network card can decapsulate packets correctly (May be wrong here.. can't remember), to be handed off to your application.

http://en.wikipedia.org/wiki/Transmission_Control_Protocol

I Believe TCP encapsulation is done by the Nic, not by the OS, The OS hands a stream of data to the transport layer, which divides this stream into segments (then --> packets --> frames and finally physical signal)

Anyway why would you want to do this? It would be far easier to just change the protocol stack, wouldn't it?
 
Last edited:
  • #7
Well, i think TCP is handed by the OS. I remember things like the TCP window size, congestion avoidance, etc..., and i don't see the NIC doing these things. At least early TCP implementations weren't on the NIC i bet. If this is true then you can avoid ports and sockets completely through code (code a part of the OS on the server & client).
I think the advantage would be increased security, though it's nothing very feasible. You could also use this, possibly, to disrupt communications. If can fake TCP segments then i might flood the network with ACK/NACK packets for example. That would be cool. :smile:

Actually, you know what, i remember wanting to try to fake ACK/NACKs and needing a NIC that allows me to put the TCP segments together myself. So i suppose TCP encapsulation is done at the NIC. :(
 
Last edited:
  • #8
Well, i think TCP is handed by the OS. I remember things like the TCP window size, congestion avoidance, etc..., and i don't see the NIC doing these things. At least early TCP implementations weren't on the NIC i bet. If this is true then you can avoid ports and sockets completely through code (code a part of the OS on the server & client).
I think the advantage would be increased security, though it's nothing very feasible. You could also use this, possibly, to disrupt communications. If can fake TCP segments then i might flood the network with ACK/NACK packets for example. That would be cool.

Actually, you know what, i remember wanting to try to fake ACK/NACKs and needing a NIC that allows me to put the TCP segments together myself. So i suppose TCP encapsulation is done at the NIC. :(

http://en.wikipedia.org/wiki/Network_card
A network card, network adapter, network interface card or NIC is a piece of computer hardware designed to allow computers to communicate over a computer network. It is an OSI model layer 2 item because it has a MAC address.

I think you are right, The NIC only cares about Layer 1 and 2, layer 3 and 4 are done on the OS in kernal space (It is done on hardware with routers/Firewalls but on with Workstations/servers)... Guess you were correct. It makes sense when you think about it, because we are the ones who load the Protocol Stack on the OS, and can unload it if we want.

There is a way to avoid windows sockets and ports by using 'raw sockets' however (obviously as it is) YOU as the app writer have to do the encapsulation of streams into packets etc on your own

http://en.wikipedia.org/wiki/Raw_sockets
 
  • #9
Jms

Hi LM741,

If you're interested in other ways to allow multiple java apps to communicate (than writing your own protocol), you should try JMS or it's serverless alternative, Mantaray MQ. :)
 

1. What is the difference between networks and sockets?

Networks and sockets are two different means of communication in computer networks. Networks refer to the physical infrastructure that connects devices, while sockets refer to the software interface used for communication between devices.

2. How are networks used as an alternative to sockets?

Networks can be used as an alternative to sockets by using a higher-level communication protocol, such as HTTP or FTP, to establish communication between devices. This eliminates the need for low-level socket programming.

3. What are the advantages of using networks over sockets?

Using networks as an alternative to sockets can provide several advantages, such as simplified communication, better security, and the ability to use higher-level protocols that offer more features and functionality.

4. Is it necessary to have a deep understanding of networks to use them as an alternative to sockets?

No, it is not necessary to have a deep understanding of networks to use them as an alternative to sockets. Many high-level communication protocols abstract away the complexities of networks, making it easier for developers to use them without extensive knowledge of network protocols.

5. Are there any limitations to using networks as an alternative to sockets?

One limitation of using networks as an alternative to sockets is that it may not be suitable for real-time communication, as there may be delays due to the use of higher-level protocols. Additionally, some network protocols may not be supported by all devices, limiting their use as an alternative to sockets.

Similar threads

  • Programming and Computer Science
Replies
7
Views
466
  • Computing and Technology
Replies
14
Views
1K
  • Computing and Technology
Replies
4
Views
1K
  • Programming and Computer Science
Replies
28
Views
712
  • Computing and Technology
Replies
15
Views
2K
  • Programming and Computer Science
Replies
1
Views
980
Replies
1
Views
923
  • Engineering and Comp Sci Homework Help
Replies
1
Views
623
  • Computing and Technology
Replies
12
Views
4K
  • Computing and Technology
Replies
1
Views
1K
Back
Top