Jump to content

Recommended Posts

Posted

Wouldn't it be better with sockets? I used to face problems trading datagram packets between machines who belong to different networks.

choose DatagramSockets because Sockets had a limitation in connection(only 1 client can connect)  because of  streams 

Posted

choose DatagramSockets because Sockets had a limitation in connection(only 1 client can connect)  because of  streams 

 

In combination with threads you can connect to multiple clients. But, in this occasions, it seems that Datagrams are fine, by the time packet order doesn't matter.

 

Also, you propably forgot to send the online data back to the client, at the online command.

Posted

In combination with threads you can connect to multiple clients. But, in this occasions, it seems that Datagrams are fine, by the time packet order doesn't matter.

I was afraid of packet loss/order but most of people going to use it through localhost and if machine I think machine have connection speed enough to send and recieve data without any problems.

 

Also, you propably forgot to send the online data back to the client, at the online command.

updated thanks

Posted

U guys suck at channels and threading.

 

Datagram = (unreliable connection - that's its naming, but its a good thing!) simple minded. Connection - W <-> R, end; Perfect for telnets. Or command servers.

TCP = (Transport Protocol) bad for such a thing, you need to maintain a connection, that is always vulnerable.

 

You guys should check out SocketChannels and Datagram channels in the nio package.

 

Edit: Dat http://docs.oracle.com/javase/7/docs/api/java/nio/channels/package-summary.html

Posted

Also, you MUST add some more server-side checks about the password, because in that way if someone codes his own gui, which doesn't ask for a password, he would be able to send commands normally.

 

A good idea is that after password check, the server should accept packets only by the approved ip address.

Posted

Also, you MUST add some more server-side checks about the password, because in that way if someone codes his own gui, which doesn't ask for a password, he would be able to send commands normally.

 

A good idea is that after password check, the server should accept packets only by the approved ip address.

Just a boolean in server-side code.

Posted

Sorry, for keep messing with this one, but you reminded me to add a telnet system to pes, and while I was working on it I also realised that your client is not working too. But, the sample client that I coded worked fine.

 

telnet

 

package com.pauler;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;
import java.net.UnknownHostException;

public class TelnetClient {

DatagramSocket socket;

public TelnetClient() {
	while (true) {
		try {
			socket = new DatagramSocket();
		} catch (SocketException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}

		try {
			sendData("wswsws".getBytes(), InetAddress.getByName("127.0.0.1"), 1234);
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		try {
			Thread.sleep(3000);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}

public static void main(String[] args) {
	getInstance();
}

public static TelnetClient getInstance() {
	return SingletonHandler._instance;
}

public void sendData(byte[] data, InetAddress ipAddress, int packetPort)
{
	DatagramPacket packet = new DatagramPacket(data, data.length, ipAddress, packetPort);
	try
	{
		socket.send(packet);
	}
	catch (IOException e)
	{
		e.printStackTrace();
	}
	System.out.println("sent : " + new String(data));
}

private static class SingletonHandler {
	protected static final TelnetClient _instance = new TelnetClient();
}
}

 

 

Posted

Sorry, for keep messing with this one, but you reminded me to add a telnet system to pes, and while I was working on it I also realised that your client is not working too. But, the sample client that I coded worked fine.

 

telnet

 

package com.pauler;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;
import java.net.UnknownHostException;

public class TelnetClient {

DatagramSocket socket;

public TelnetClient() {
	while (true) {
		try {
			socket = new DatagramSocket();
		} catch (SocketException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}

		try {
			sendData("wswsws".getBytes(), InetAddress.getByName("127.0.0.1"), 1234);
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		try {
			Thread.sleep(3000);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}

public static void main(String[] args) {
	getInstance();
}

public static TelnetClient getInstance() {
	return SingletonHandler._instance;
}

public void sendData(byte[] data, InetAddress ipAddress, int packetPort)
{
	DatagramPacket packet = new DatagramPacket(data, data.length, ipAddress, packetPort);
	try
	{
		socket.send(packet);
	}
	catch (IOException e)
	{
		e.printStackTrace();
	}
	System.out.println("sent : " + new String(data));
}

private static class SingletonHandler {
	protected static final TelnetClient _instance = new TelnetClient();
}
}

 

 

Damn, forgot to add port when you connect . im fking idiot

so the jar was sending to other port this is why the server didn't respond.

Updated the jar

bq8s.png

download : http://www.4shared.com/file/jMwT12D0/Telnet.html

code : http://pastebin.com/gcH4J8Xz

 

Also added a boolean check if connected to be more secured

 

really sorry i dont know how i forgot to add the port

 

Posted

Damn, forgot to add port when you connect . im fking idiot

so the jar was sending to other port this is why the server didn't respond.

Updated the jar

bq8s.png

download : http://www.4shared.com/file/jMwT12D0/Telnet.html

code : http://pastebin.com/gcH4J8Xz

 

Also added a boolean check if connected to be more secured

 

really sorry i dont know how i forgot to add the port

 

Again, it is not secured. Once it gets to true, everyone would be able to connect by a custom client.
Posted

Again, it is not secured. Once it gets to true, everyone would be able to connect by a custom client.

So only 1 connection to server ?

 

added video

 

Guest
This topic is now closed to further replies.


  • Posts

    • From Salvation onwards I think you need a patched nwindow.dll that allows such modifications, try to see if you get what you need here: https://drive.google.com/drive/u/1/folders/1LLbQFGf8KlR-O0Iv5umfF-pwZgrDh9bd
    • hello everyone! I am wanting to save the files (Ini. - Data - ) of the EP5 Client: Salvation... But they generate the error "corrupt files"... I tried several versions of L2FileEditor without good results. I need help! Thank you!
    • Opening December 6th at 19:00 (GMT +3)! Open Beta Test from November 30th!   https://l2soe.com/   🌟 Introducing L2 Saga of Eternia: A Revolution in Lineage 2 High Five! 🌟   Dear Lineage 2 enthusiasts, Prepare to witness the future of private servers! L2 Saga of Eternia is not just another High Five project—it’s a game-changing experience designed to compete with the giants of the Lineage 2 private server scene. Built for the community, by the community, we’re here to raise the bar in quality, innovation, and longevity. What Sets Us Apart? 💎 No Wipes, Ever Say goodbye to the fear of losing your progress. Our server is built to last and will never close. Stability and consistency are our promises to you. ⚔️ Weekly New Content Our dedicated development team ensures fresh challenges, events, and updates every week. From custom quests to exclusive features, there will always be something exciting to explore. 💰 No Pay-to-Win Skill and strategy matter most here. Enjoy a balanced gameplay environment where your achievements come from effort, not your wallet. 🌍 A Massive Community With 2000+ players expected, join a vibrant and active community of like-minded adventurers ready to conquer the world of Aden. 🏆 Fair and Competitive Gameplay Our systems are designed to promote healthy competition while avoiding abusive mechanics and exploits. 🔧 Professional Development From advanced bug fixes to carefully curated content, we pride ourselves on smooth performance, no lag, and unparalleled server quality. Key Features Chronicle: High Five with unique interface Rate: Dynamic x10 rates Class Balance: Carefully fine-tuned for a fair experience PvP Focused: PvP Ranking & aura display effect for 3 Top PvPers every week Custom Events: Seasonal and permanent events to keep you engaged Additional Features:   Custom Endgame Content: Introduce unique dungeons, raids, or zones unavailable in other servers. Player-Driven Economy: Implement a strong market system and avoid overinflated drops or rewards. Epic Siege Battles: Announce special large-scale sieges and PvP events. Incentives for Streamers and Clans: Attract influencers and big clans to boost server publicity. Roadmap Transparency: Share a public roadmap of planned updates to build trust and excitemen   Here you can read all the features: https://l2soe.com/features   Video preview: Join the Revolution! This is your chance to be part of something legendary. L2 Saga of Eternia is not just a server; it’s a movement to redefine what Lineage 2 can be. Whether you’re a seasoned veteran or a newcomer to the world of Aden, we invite you to experience Lineage 2 at its finest.   Official Launch Date: December 6th 2024 Website: https://l2soe.com/ Facebook: https://www.facebook.com/l2soe Discord: https://discord.com/invite/l2eternia   Let’s build the ultimate Lineage 2 experience together. See you in-game! 🎮
    • That's like a tutorial on how to run l2 on MacOS Xd but good job for the investigation. 
  • Topics

×
×
  • Create New...