Skip to content

Instantly share code, notes, and snippets.

View teocci's full-sized avatar
👨‍💻
Coding

Teocci teocci

👨‍💻
Coding
View GitHub Profile
  • WebRTC in the real world: STUN, TURN and signaling Coding WebRTC for signaling

    Below is a W3C code example that summarises the complete signaling process. The code assumes the existence of some signaling mechanism, SignalingChannel. Signaling is discussed in greater detail below.

    var signalingChannel = new SignalingChannel();
    var configuration = {
    
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

Java API for WebSocket

Java API for WebSocket 1.0 is one of the major developments in Java EE 7. Here is a sample code to run our first websocket chatting app.

Objectives:

  • How to build websocket app using Java API?
  • Build websocket server
  • Build websocket desktop “console” client in Java
  • Build webscoket web client using Webscoket JS object.

Web Application based on WebSocket API for Java

This tutorial demonstrates how to create a simple web application that enables collaboration between client browsers that are connected to a single server. When a user draws a graphic element on the canvas in his client browser the element appears on the canvas of all connected clients.

How does it work? Well, when the browser loads the web page a client-side script sends a WebSocket handshake request to the application server. The application can accept JSON and binary messages from the clients connected in the session and broadcast the messages to all the connected clients.

In this github project you can find a web application that uses the Java API for WebSocket (JSR 356) to enable bi-directional communication between browser clients and the application server. The Java API for WebSocket provides support for creating WebSocket Java components, initiating and intercepting WebSocket events and creating and consu

Sockets: A tutorial to write a client/server applications in Java

This tutorial presents an introduction to sockets programming over TCP/IP networks and demonstrates how to write client/server applications in Java.

A bit of history

The Unix input/output (I/O) system follows a paradigm usually referred to as Open-Read-Write-Close. Before a user process can perform I/O operations, it calls Open to specify and obtain permissions for the file or device to be used. Once an object has been opened, the user process makes one or more calls to Read or Write data. Read reads data from the object and transfers it to the user process, while Write transfers data from the user process to the object. After all transfer operations are complete, the user process calls Close to inform the operating system that it has finished using that object.

When facilities for InterProcess Communication (IPC) and networking were added to Unix, the idea was to make the interface to IPC similar to that of file I/O. In Unix, a process