Jump to content

sending packets issue


pitman-87

Recommended Posts

Hi guys,

 

I have some issues with sending packets from client to server, it crashes every time and I couldn't find out why.

I looked up the Ironchest code and this one: https://github.com/DarkGuardsman/GSM-Guardsman/blob/master/1.3.1/common/GSM/Network/PacketManager.java

 

my code (client):

public static void sendAddFrequency(int frequency, int x, int y, int z)
{
	ByteArrayOutputStream bytes = new ByteArrayOutputStream();
	DataOutputStream data = new DataOutputStream(bytes);
	int[] dataInt =
	{ 0, frequency, x, y, z };

	try
	{
		for (int i = 0; i < 5; i++)
		{
			data.writeInt(dataInt[i]);
		}

	} catch (IOException e)
	{
	}

	Packet250CustomPayload pkt = new Packet250CustomPayload();
	pkt.channel = "TF2_Teleporter_Chan";
	pkt.data = bytes.toByteArray();
	pkt.length = bytes.size();
	pkt.isChunkDataPacket = true;
	PacketDispatcher.sendPacketToServer(pkt);

}

 

But all I got is this error:

2012-08-17 01:57:19 [iNFO] [ForgeModLoader] Forge Mod Loader version 3.0.68.286 for Minecraft client:1.3.2, server:1.3.2 loading
2012-08-17 01:57:21 [iNFO] [sTDOUT] 27 achievements
2012-08-17 01:57:21 [iNFO] [sTDOUT] 195 recipes
2012-08-17 01:57:21 [iNFO] [sTDOUT] Setting user: Player13, -
2012-08-17 01:57:21 [iNFO] [sTDERR] Client asked for parameter: server
2012-08-17 01:57:21 [iNFO] [sTDOUT] LWJGL Version: 2.4.2
2012-08-17 01:57:21 [iNFO] [ForgeModLoader] Attempting early MinecraftForge initialization
2012-08-17 01:57:21 [iNFO] [ForgeModLoader] Completed early MinecraftForge initialization
2012-08-17 01:57:22 [iNFO] [ForgeModLoader] Searching D:\workspace\MC 1.3.2\jars\mods for mods
2012-08-17 01:57:22 [iNFO] [ForgeModLoader] Forge Mod Loader has identified 3 mods to load
2012-08-17 01:57:22 [iNFO] [sTDOUT] Starting up SoundSystem...
2012-08-17 01:57:23 [iNFO] [sTDOUT] Initializing LWJGL OpenAL
2012-08-17 01:57:23 [iNFO] [sTDOUT]     (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
2012-08-17 01:57:23 [iNFO] [sTDOUT] OpenAL initialized.
2012-08-17 01:57:23 [iNFO] [ForgeModLoader] Forge Mod Loader has successfully loaded 3 mods
2012-08-17 01:57:27 [iNFO] [sTDERR] java.io.IOException: Server returned HTTP response code: 503 for URL: http://skins.minecraft.net/MinecraftCloaks/Player13.png
2012-08-17 01:57:27 [iNFO] [sTDERR] 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
2012-08-17 01:57:27 [iNFO] [sTDERR] 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
2012-08-17 01:57:27 [iNFO] [sTDERR] 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
2012-08-17 01:57:27 [iNFO] [sTDERR] 	at java.lang.reflect.Constructor.newInstance(Unknown Source)
2012-08-17 01:57:27 [iNFO] [sTDERR] 	at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
2012-08-17 01:57:27 [iNFO] [sTDERR] 	at java.security.AccessController.doPrivileged(Native Method)
2012-08-17 01:57:27 [iNFO] [sTDERR] 	at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
2012-08-17 01:57:27 [iNFO] [sTDERR] 	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
2012-08-17 01:57:27 [iNFO] [sTDERR] 	at net.minecraft.src.ThreadDownloadImage.run(ThreadDownloadImage.java:48)
2012-08-17 01:57:27 [iNFO] [sTDERR] Caused by: java.io.IOException: Server returned HTTP response code: 503 for URL: http://skins.minecraft.net/MinecraftCloaks/Player13.png
2012-08-17 01:57:27 [iNFO] [sTDERR] 	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
2012-08-17 01:57:27 [iNFO] [sTDERR] 	at java.net.HttpURLConnection.getResponseCode(Unknown Source)
2012-08-17 01:57:27 [iNFO] [sTDERR] 	at net.minecraft.src.ThreadDownloadImage.run(ThreadDownloadImage.java:37)
2012-08-17 01:57:27 [iNFO] [sTDERR] java.io.IOException: Server returned HTTP response code: 503 for URL: http://skins.minecraft.net/MinecraftSkins/Player13.png
2012-08-17 01:57:27 [iNFO] [sTDERR] 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
2012-08-17 01:57:27 [iNFO] [sTDERR] 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
2012-08-17 01:57:27 [iNFO] [sTDERR] 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
2012-08-17 01:57:27 [iNFO] [sTDERR] 	at java.lang.reflect.Constructor.newInstance(Unknown Source)
2012-08-17 01:57:27 [iNFO] [sTDERR] 	at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
2012-08-17 01:57:27 [iNFO] [sTDERR] 	at java.security.AccessController.doPrivileged(Native Method)
2012-08-17 01:57:27 [iNFO] [sTDERR] 	at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
2012-08-17 01:57:27 [iNFO] [sTDERR] 	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
2012-08-17 01:57:27 [iNFO] [sTDERR] 	at net.minecraft.src.ThreadDownloadImage.run(ThreadDownloadImage.java:48)
2012-08-17 01:57:27 [iNFO] [sTDERR] Caused by: java.io.IOException: Server returned HTTP response code: 503 for URL: http://skins.minecraft.net/MinecraftSkins/Player13.png
2012-08-17 01:57:27 [iNFO] [sTDERR] 	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
2012-08-17 01:57:27 [iNFO] [sTDERR] 	at java.net.HttpURLConnection.getResponseCode(Unknown Source)
2012-08-17 01:57:27 [iNFO] [sTDERR] 	at net.minecraft.src.ThreadDownloadImage.run(ThreadDownloadImage.java:37)
2012-08-17 01:57:30 [sEVERE] [ForgeModLoader] A critical server error occured handling a packet, kicking net.minecraft.src.NetServerHandler@6ee7e2ec
2012-08-17 01:57:33 [iNFO] [sTDERR] Someone is closing me!

 

build is #199

Link to comment
Share on other sites

bad idea to use  my code its not 100% stable. Also most of that error has to do with minecraft not downloading the skin for player13. Also where is your code that receives that packet because that might be the error. Currently i'm having issue in my code where the data stream is being read past the actual length of the stream. Which causes an error reading the packet but no crash.

Link to comment
Share on other sites

bad idea to use  my code its not 100% stable. Also most of that error has to do with minecraft not downloading the skin for player13. Also where is your code that receives that packet because that might be the error. Currently i'm having issue in my code where the data stream is being read past the actual length of the stream. Which causes an error reading the packet but no crash.

 

I quess this have nothing todo with the 503-error (it appears everytime on startup), the actual error is this:

2012-08-17 01:57:30 [sEVERE] [ForgeModLoader] A critical server error occured handling a packet, kicking net.minecraft.src.NetServerHandler@6ee7e2ec

 

But I could figured out, after I started client and server seperatly, there was a "real" error-code (NPE).

(I was opening the gui on server too (forgot world.isRemote)).

 

 

For your length-of-stream-problem I'm sending the length too ;)

1. type-id

2. length

3. actual data

 

It's a great help, if you are sending arrays with different lengths.

Link to comment
Share on other sites

bad idea to use  my code its not 100% stable. Also most of that error has to do with minecraft not downloading the skin for player13. Also where is your code that receives that packet because that might be the error. Currently i'm having issue in my code where the data stream is being read past the actual length of the stream. Which causes an error reading the packet but no crash.

 

I quess this have nothing todo with the 503-error (it appears everytime on startup), the actual error is this:

2012-08-17 01:57:30 [sEVERE] [ForgeModLoader] A critical server error occured handling a packet, kicking net.minecraft.src.NetServerHandler@6ee7e2ec

 

But I could figured out, after I started client and server seperatly, there was a "real" error-code (NPE).

(I was opening the gui on server too (forgot world.isRemote)).

 

 

For your length-of-stream-problem I'm sending the length too ;)

1. type-id

2. length

3. actual data

 

It's a great help, if you are sending arrays with different lengths.

lol that would cuase that. Anyways thank for the tip i forgot i can send the packet length with it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.