Is it possible to create a connection between Server-Client using ipv4 ip?

Hi guys, I made some online games thanks to processing.net library but, I got a problem :
the only way that I found to create a connection between Server-Client is using ipv6 but the problem is that I asked my operator for a static ipv6 but he couldn’t so the only static ip I can get is the ipv4 but processing.net seems to not work with ipv4 (only with ipv6) so guys, can anyone tell me is there is a way to use processing net using ipv4?

sorry, never play with this, but when i try
/ Examples / Libraries / Network / SharedCanvasClient /
& SharedCanvasServer
from 2 computer in my LAN it works using

Client(this, "192.168.1.203",12345)

as server IP

so why you not make a
a minimal, complete and verifiable example ( MCVE )
showing your problem.

Well, of course, here is the code for an simple sharing of 2positions of cubes :

Server :

import processing.net.*;

Server s; 
Client c;
String input;
int data[];

int x;
int y;


int oX;
int oY;

void setup() { 
  size(600, 400);
  background(204);
  stroke(0);
  
    s = new Server(this, 12345);
}

void draw() { 
  background(0);
  
  key();
  send();
  receive();
  
  fill(255);
  rect(x,y,30, 30);
  fill(100);
  rect(oX,oY,30, 30);
  
  
}

void send(){
  
   s.write(x + " " + y + "\n");
}

void receive(){
   c = s.available();
  if (c != null) {
    input = c.readString(); 
    input = input.substring(0, input.indexOf("\n"));
  data = int(split(input, ' '));
  
  oX = data[0];
  oY = data[1];
  
  }
}

void key(){
  if(keyPressed){
if(key == 'z'){
y -= 5;
}else if(key == 's'){
  y += 5;
}else if(key == 'd'){
  x += 5;
}else if(key == 'q'){
 x -= 5;
}
  }
}

and Client :

import processing.net.*; 

Client c; 
String input;
int data[]; 


int x;
int y;


int oX;
int oY;

void setup() { 
  size(600, 400);
  background(204);
  stroke(0);
  
    c = new Client(this, "2a01:e35:2f2a:520:95a3:d80c:e03a:d8ea", 12345);
}

void draw() { 
  background(0);
  
  key();
  send();
  receive();
  
  fill(255);
  rect(x,y,30, 30);
  fill(100);
  rect(oX,oY,30, 30);
  
  
}

void send(){
  
   c.write(x + " " + y + "\n");
}
void receive(){
 if (c.available() > 0) { 
    input = c.readString(); 
    input = input.substring(0,input.indexOf("\n"));  // Only up to the newline
    data = int(split(input, ' '));
    oX = data[0];
  oY = data[1];
 }
}


void key(){
  if(keyPressed){
if(key == 'z'){
y -= 5;
}else if(key == 's'){
  y += 5;
}else if(key == 'd'){
  x += 5;
}else if(key == 'q'){
 x -= 5;
}
  }
}

And you can see that the connection only works (for me) using ipv6 (but my ipv6 is dynamic)

here is the result if you use ipv4:

And here is the result when using ipv6:
(I am a new user so I can put only one image per post but, we can see on the image that when I use ipv6 , there is an established connection between Server-Client) .
So, if is oblivious that it doesn’t work for me with ipv4 but why, and how to ‘prevent’ it?

-a- might be that the problem is your network/router/server setup,
as IPv4 with processing or processing/net library works here,
but sorry, IPv6 can not test, also not know if it even should work.

-b- and for play it should be ok to use dynamic IP,
but SERVER thinking is for me connected with a static IP
( set in server device ( or by router ))
here i used a Raspberrry Pi with adding at end:
sudo nano /etc/dhcpcd.conf


interface eth0
static ip_address=192.168.1.103/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 8.8.8.8 8.8.4.4

interface wlan0
static ip_address=192.168.1.203/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 8.8.8.8 8.8.4.4

as i use the RPI mostly from remote SSH / VNC


even i can not help you with your question, possibly it is now more clear for others.

Maybe you are right and the problem is elsewhere: I asked my internet operator (free) to give me a static ip and they did but, I noticed that my ip changes only the end (I explain myself) :
Here is my ipv6 : 2a01:e35:2f2a:520:992a:177f:b2c4:**** (last carachters are covered in case ^^)
and I noticed that when it changes, it still begins by 2a01: … so maybe the problem is coming from me cause I don’t really know a lot about network (i’m 14) but, yeah. so how could I could I cahnge the router settings?

-a- from the picture i understand you use

  • processing 3.4
  • server and client code run on the same PC?? not a valid test?

-b- you state that it works

  • with ipv6
  • but not ipv4

so possibly “the” network not allow ipv4 communication??
sorry, but without 2 devices in YOUR OWN network
it might be very limited to play with that kind of things.

and if it is not YOUR router do not mess with it!

Are both server & client sketches running on the same computer?
Or are they on diff. computers but on the same LAN?

It is rare, but it’s possible that an ISP installs a simple modem in our home instead of a complete modem+router.

If it is the former, we need to buy a router in order to get LAN IPs.
Otherwise, our only LAN IP would be the same as our WAN IP.