UDP is definitely not something you can do from JavaScript in a web browser. Arbitrary TCP is also not possible, however HTTP technically is a TCP based protocol, and “web sockets” can be used very much like a TCP connection between JavaScript in a web browser and an HTTP server expecting such a connection. Libraries such as socket.io are designed to facilitate the use of web sockets to send messages back and forth between web browsers and servers (they actually leverage a few different techniques depending on browser compatibility).
P5.js itself does not have any special support for web sockets, but it does have some helper functions for issuing HTTP requests and loading data from URLs fetched via HTTP: p5.js IO functions.
Depending on the situation, it should be developed in ‘JAVA mode’ or through ‘WEB’.
In ‘JAVA mode’, it mainly communicates with the server using TCP/IP & UDP.
Implementation with ‘p5.js’ requires re-framing the communication.
(Of course, the screen composition will have to be redesigned.)
I fully understood through your answer. thank you.