Wired ethernet udp connection between laptop and end device

Hi, I currently have a laptop and end device with an ethernet cable between them, running on udp protocol. I would like to change the cable into a wireless connection.

In my setup I have an iBoard Ex and XBee 900HP. iBoard Ex comes with wiznet w5100. I am trying to convert the udp data from laptop into serial to parse into xbee, and on the other side xbee receives the data and changes it back to udp to go into the ethernet cable to the end device. The 2 xbees are already paired together. I would like it to work both ways, meaning end device can also transmit data to laptop.

From what I have read about udp, I need to open up a port to connect. But if I just want to get the data from the ethernet cable directly, is it possible without opening any ports?

Sorry new to wireless, please help. Thanks.

http://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/udp-examples.html

.

Sorry was using my phone just now so did not post my code. Below is the code that I am using. Would like to check whether I need to assign a port? Since I am not sure about the current protocol which port does it use since the 2 devices are connected via an ethernet cable.

#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>

byte mac[] = {__, __, __, __, __, __};	// MAC address of controller

unsigned int myPort = 43770;		// local port to listen on
unsigned int yourPort = 43770;		// remote port to send to

EthernetUDP udp;		// an EthernetUDP instance to let us send and receive packets over UDP

void setup(){
	Serial.begin(115200);
	Serial1.begin(115200);

	Ethernet.begin (mac);			// Start Ethernet connection DHCP
	if (Ethernet.begin(mac) == 0){
		Serial.println(“DHCP error”);	// report failure to obtain network parameters
		While(true){}			// no point in carrying on, loop indefinitely
	}
	// show the local IP address
	Serial.print (“Local IP: “);
	Serial.println (Ethernet.localIP());

	udp.begin (myPort);	// Start UDP
	delay(1000);

IPAddress yourIp = udp.remoteIP();
	udp.beginPacket(yourIp, yourPort);
}

void loop(){
	getData(udp, myPort);			// udp to xbee
	sendData(udp, yourIp, yourPort);		// xbee to udp

	Ethernet.maintain();			// for renewal of DHCP leases
}

void getData (EthernetUDP thisUDP, unsigned int thisPort) {
	// if UDP data available, parse out the header
	int packetSize = thisUDP.parsePacket();
	if (packetSize){
Serial.print (“Received packet of size “);
		Serial.println (packetSize);
		Serial.print (“From: “);
		for (int i=0; i<4; i++){
			Serial.print (yourIp[i], DEC);
			if (i<3){
				Serial.print(“ “);
			}
		}

		Serial.print (“, port ”);
		unsigned int yourPort = thisUDP.remotePort();
		Serial.println (yourPort);

		// send the payload out the serial port
		while (thisUDP.available()){
			// read the packet into packetBuffer
			int udpByte = thisUDP.read();
			Serial.write(udpByte);		// send data to serial monitor
			Serial1.write(udpByte);		// send data to xbee
		}
	}
}

void sendData (EthernetUDP thisUDP, unsigned int destIp, unsigned int destPort) {
if (Serial1.available()) {
		int serialByte = Serial1.read();
		
		// if get 0x7E, send packet and begin new one
		if (serialByte == 0x7E) {
			thisUDP.endPacket();
			thisUDP.beginPacket(destIp, destPort);
		}
		
		thisUDP.write(serialByte);
	}
}

This is the processing sketch to test out the code.

/*
	Processing UDP example to send and receive string data from Arduino.
	Press any key to send the “Hello Arduino” message.
*/

import hypermedia.net.*;	// import the UDP library

UDP udp;		// define the UDP object

void setup(){
	udp = new UDP (this, 43770);		// create a new datagram connection on port 6000
	// udp.log (true);			// printout the connection activity
	udp.listen (true);			// and wait for incoming message
}


void draw(){
}


void keyPressed(){
	int destPort = 43770;
	String ip = “255.255.255.255”;			// broadcast message
	udp.send (“Hello World\n”, ip, destPort);		// the message to send
}


void receive (byte[] data){
	// print the incoming data bytes as ASCII characters
	for (int i=0; i<data.length; i++) {
		print (char (data[i]));
	}
	println();
}

Also I have a feeling I might not need to connect to the internet at all, since I only want to get the UDP data from the cable and parse it into XBee, on the other side get the data from XBee and parse it into the ethernet cable via UDP. The devices should be able to read the data going into the cables directly?