Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.13.2] InputStream only receives input on shutdown
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 3
TreePuncher

[1.13.2] InputStream only receives input on shutdown

By TreePuncher, June 11 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

TreePuncher    0

TreePuncher

TreePuncher    0

  • Tree Puncher
  • TreePuncher
  • Members
  • 0
  • 3 posts
Posted June 11

so I have a Socket and trying to get data from the socket but I only get the data when I shutdown the socket

here is my code
 

try{
	Socket socket = new Socket(host,port);
	InputStream input = socket.getInputStream();
	BufferedReader reader = new BufferedReader(new InputStreamReader((input)));
	String line;
	while ((line = reader.readLine()) != null) {
		System.out.printIn(line);
	}
}

 

so it only logs the line when I shutdown the server...
but I want it to log the line everytime the socket sends something

btw I run the socket in a new thread aswell otherwise it froze my minecraft

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2093

Draco18s

Draco18s    2093

  • Reality Controller
  • Draco18s
  • Members
  • 2093
  • 14023 posts
Posted June 12

You're almost certainly locking up the main thread while you do....that

  • Quote

Share this post


Link to post
Share on other sites

TreePuncher    0

TreePuncher

TreePuncher    0

  • Tree Puncher
  • TreePuncher
  • Members
  • 0
  • 3 posts
Posted June 12

if it is locking the main thread while doing that, how come that it does not freeze my minecraft?

and how would you reccomand me on doing it then?

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6680

diesieben07

diesieben07    6680

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6680
  • 45687 posts
Posted June 12

Using raw sockets like this is almost never a good idea.

What are you trying to achieve?

  • Quote

Share this post


Link to post
Share on other sites

TreePuncher    0

TreePuncher

TreePuncher    0

  • Tree Puncher
  • TreePuncher
  • Members
  • 0
  • 3 posts
Posted June 12
7 hours ago, diesieben07 said:

Using raw sockets like this is almost never a good idea.

What are you trying to achieve?

a live chat between multiple clients 

where they dont require to be on the same server.

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6680

diesieben07

diesieben07    6680

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6680
  • 45687 posts
Posted June 12
24 minutes ago, TreePuncher said:

a live chat between multiple clients 

where they dont require to be on the same server.

Okay. You should use Netty. Minecraft already comes with it.

  • Quote

Share this post


Link to post
Share on other sites

ImANoobApperntly    0

ImANoobApperntly

ImANoobApperntly    0

  • Tree Puncher
  • ImANoobApperntly
  • Members
  • 0
  • 14 posts
Posted June 12

Is Netty compatible with a socket server? if so how would I use it?
Im trying todo something similar to Mister Tree Puncher and have the same problem.

  • Quote

Share this post


Link to post
Share on other sites

Cadiboo    277

Cadiboo

Cadiboo    277

  • Reality Controller
  • Cadiboo
  • Members
  • 277
  • 3303 posts
Posted June 13

Netty is a proper networking library. It has documentation

  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 3
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • DaemonUmbra
      Can't see anything on minecraft menu screen except for the bottom left corner

      By DaemonUmbra · Posted 12 minutes ago

      Please don't Necro old threads, if you have an issue make your own.
    • DaemonUmbra
      Forge having problem loading mods

      By DaemonUmbra · Posted 12 minutes ago

      You changed "Game Directory" to your mods folder. The Game Directory is supposed to be the folder that contains the mods folder, .minecraft by default
    • Casual
      1.12.2 crash on game start

      By Casual · Posted 16 minutes ago

      Ok to add on, had to do manual library install due to failed library install thing, also there is never another window It just closes the launcher window and then reopens it with the error.
    • Cosmic_Cookie
      Can't see anything on minecraft menu screen except for the bottom left corner

      By Cosmic_Cookie · Posted 25 minutes ago

      Hey, I have the same problem except my screen is black instead of white and this doesn't work. I know it's years later but maybe someone can help.
    • Cosmic_Cookie
      [1.12.2] Forge Crashes While Just Loading Into Loading Screen

      By Cosmic_Cookie · Posted 38 minutes ago

      Nvm wrong topic
  • Topics

    • florgonn
      4
      Can't see anything on minecraft menu screen except for the bottom left corner

      By florgonn
      Started July 30, 2014

    • SilviaX_92
      3
      Forge having problem loading mods

      By SilviaX_92
      Started 3 hours ago

    • Casual
      1
      1.12.2 crash on game start

      By Casual
      Started 41 minutes ago

    • PulseBeat_02
      14
      [1.12.2] Forge Crashes While Just Loading Into Loading Screen

      By PulseBeat_02
      Started December 12, 2018

    • GeokitFX
      1
      Minecraft Custom mod pack crashing i need help

      By GeokitFX
      Started 1 hour ago

  • Who's Online (See full list)

    • Casual
    • Vorquel
    • JMAS
    • Epicmoofish
    • creepaaa
    • DaemonUmbra
    • yuusha
    • Darren Hayden
    • AtlasTheFirst
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.13.2] InputStream only receives input on shutdown
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community