Tutorial by Examples: communication

Server: Start, and wait for incoming connections //Open a listening "ServerSocket" on port 1234. ServerSocket serverSocket = new ServerSocket(1234); while (true) { // Wait for a client connection. // Once a client connected, we get a "Socket" object // that c...
Channels can be used to send data from one thread to another. Below is an example of a simple producer-consumer system, where the main thread produces the values 0, 1, ..., 9, and the spawned thread prints them: use std::thread; use std::sync::mpsc::channel; fn main() { // Create a channel...
This code example creates a TCP client, sends "Hello World" over the socket connection, and then writes the server response to the console before closing the connection. // Declare Variables string host = "stackoverflow.com"; int port = 9999; int timeout = 5000; // Create ...
As Handlers are used to send Messages and Runnables to a Thread's message queue it's easy to implement event based communication between multiple Threads. Every Thread that has a Looper is able to receive and process messages. A HandlerThread is a Thread that implements such a Looper, for example th...
Matlab supports synchronous and asynchronous communication with a serial port. It is important to chose the right communication mode. The choice will depend on: how the instrument you are communicating with behave. what other functions your main program (or GUI) will have to do aside from managi...
Client.java import java.io.*; import java.net.*; public class Client{ public static void main(String [] args) throws IOException{ DatagramSocket clientSocket = new DatagramSocket(); InetAddress address = InetAddress.getByName(args[0]); String ex = "He...
Example demonstrates component composition and one-way message passing from parent to children. 0.18.0 Component composition relies on Message tagging with Html.App.map 0.18.0 In 0.18.0 HTML.App was collapsed into HTML Component composition relies on Message tagging with Html.map Example ...
Session Types are a way to tell the compiler about the protocol you want to use to communicate between threads - not protocol as in HTTP or FTP, but the pattern of information flow between threads. This is useful since the compiler will now stop you from accidentally breaking your protocol and causi...
WebSocket provides a duplex/bidirectional communication protocol over a single TCP connection. the client opens a connection to a server that is listening for a WebSocket request a client connects to a server using a URI. A server may listen to requests from multiple clients. Server Endpoint...
To setup a WebRTC-based communication system, you need three main components: A WebRTC signaling server To establish a WebRTC connections, peers need to contact a signaling server, which then provides the address information the peers require to set up a peer-to-peer connection. Signaling serv...
Android Activity package com.example.myapp; import android.os.Bundle; import android.app.Activity; import android.webkit.WebView; public class WebViewActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceSta...
Basic Example package com.example.myapp; import android.os.Bundle; import android.app.Activity; import android.webkit.WebView; public class WebViewActivity extends Activity { private Webview webView; @Override protected void onCreate(Bundle savedInstanceState) { ...
When using a WebView to display your own custom webpage and this webpage contains Javascript, it might be necessary to establish a two-way communication between the Java program and the Javascript in the web page. This example shows how to setup such a communication. The webpage shall display an i...
Main process source code index.js: const {app, BrowserWindow, ipcMain} = require('electron') let win = null app.on('ready', () => { win = new BrowserWindow() win.loadURL(`file://${__dirname}/index.html`) win.webContents.openDevTools() win.on('closed', () => { win = null ...
Interprocess communication allows programmers to communicate between different processes. For example let us consider we need to write an PHP application that can run bash commands and print the output. We will be using proc_open , which will execute the command and return a resource that we can com...
Create index.js as const {app, BrowserWindow, ipcMain} = require('electron') let win = null app.on('ready', () => { win = new BrowserWindow() win.loadURL(`file://${__dirname}/index.html`) win.webContents.openDevTools() win.on('closed', () => { win = null }) }) ipcM...
In this example we will make use of Redux and React Redux modules to handle our application state and for auto re-render of our functional components., And ofcourse React and React Dom You can checkout the completed demo here In the example below we have three different components and one connecte...
In this very first example, a basic serial write operation is started from an Arduino device. void setup() { // put your setup code here, to run once: Serial.begin(9600); } void loop() { // put your main code here, to run repeatedly: Serial.println("Hello World!"); dela...
All communications between Fragments must go via an Activity. Fragments CANNOT communicate with each other without an Activity. Additional Resources How to implement OnFragmentInteractionListener Android | Communicating With Other Fragments In this sample, we have a MainActivity that hosts t...
USE [MyDatabase] CREATE MESSAGE TYPE [//initiator] VALIDATION = WELL_FORMED_XML; GO CREATE CONTRACT [//call/contract] ( [//initiator] SENT BY INITIATOR ) GO CREATE QUEUE InitiatorQueue; GO CREATE QUEUE TargetQueue; GO CREATE SERVICE InitiatorService ON QUEUE...

Page 1 of 2