Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
hellocore [2016/04/24 17:29] mroriz [HelloCore] |
hellocore [2016/04/26 14:35] mroriz |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== HelloCore ====== | ====== HelloCore ====== | ||
{{ : | {{ : | ||
- | This tutorial will guide you through the basic concepts and programming involved in the communication between a mobile node (MN) and a stationary node within the SDDL core network [[architecture|]]. This stationary node of the SDDL core will play the role of a server processing node, capable of processing application messages from the mobile node (MN) according to some application specific logic, and sending messages back to the MN. Hence, this tutorial will cover both paths of the communication, | + | This tutorial will guide you through the basic concepts and programming involved in the communication between a mobile node (MN) and a stationary node within the ContextNet |
Our sample application is composed of two components: a mobile client node and a stationary node, as illustrated in the figure on the right. The MN creates a '' | Our sample application is composed of two components: a mobile client node and a stationary node, as illustrated in the figure on the right. The MN creates a '' | ||
Line 10: | Line 10: | ||
You do not need to copy the source code snippets shown in this tutorial. At the end of each section there is a link to download the entire node source code. | You do not need to copy the source code snippets shown in this tutorial. At the end of each section there is a link to download the entire node source code. | ||
</ | </ | ||
+ | |||
===== MobileClient ===== | ===== MobileClient ===== | ||
- | To create our mobile client application, | + | To create our mobile client application, |
In SDDL, nodes that are outside the core (either mobile or stationary) interact directly with the Gateway rather than the processing nodes, since it uses a different protocol ([[ClientLib]] and [[MRUDP]]) than the core ([[wp> | In SDDL, nodes that are outside the core (either mobile or stationary) interact directly with the Gateway rather than the processing nodes, since it uses a different protocol ([[ClientLib]] and [[MRUDP]]) than the core ([[wp> | ||
Line 17: | Line 18: | ||
<code java> | <code java> | ||
public class HelloCoreClient { | public class HelloCoreClient { | ||
- | private static String gatewayIP | + | private static String |
- | private static int gatewayPort = 5500; | + | private static int |
} | } | ||
</ | </ | ||
Line 26: | Line 27: | ||
<code java> | <code java> | ||
public class HelloCoreClient { | public class HelloCoreClient { | ||
- | + | | |
- | | + | private static int gatewayPort = 5500; |
- | private static int gatewayPort = 5500; | + | private MrUdpNodeConnection connection; |
- | private MrUdpNodeConnection connection; | + | |
public static void main(String[] args) { | public static void main(String[] args) { | ||
Line 48: | Line 48: | ||
try { | try { | ||
connection = new MrUdpNodeConnection(); | connection = new MrUdpNodeConnection(); | ||
- | connection.connect(address); | ||
connection.addNodeConnectionListener(this); | connection.addNodeConnectionListener(this); | ||
+ | connection.connect(address); | ||
} catch (IOException e) { | } catch (IOException e) { | ||
e.printStackTrace(); | e.printStackTrace(); |