• 0

Java Socket Question


Question

Hey all,

I just did the Java KnockKnock and Datagram tutorial. When I run the server and client on my local network at home, it works just fine. When I run the server on my desktop at my univeristy and my client on my laptop at home, it no longer works.

Is there something simple I can do to fix this, or is there a simple explanation or reason as to why other pieces of software work just fine, but mine wont?

The tutorial

http://docs.oracle.com/javase/tutorial/networking/sockets/clientServer.html

Thanks :D

Link to comment
https://www.neowin.net/forum/topic/1141554-java-socket-question/
Share on other sites

11 answers to this question

Recommended Posts

  • 0

Turning off the firewall didn't help :( If the ports I try are blocked, how do other pieces of software have no issues? Is it because im connecting directly, vs going through a server?

Because the server is at your university. The network admin people at your university are blocking incoming connections. Outgoing connections are unaffected.

  • 0

Because the server is at your university. The network admin people at your university are blocking incoming connections. Outgoing connections are unaffected.

Wouldn't I likely have something that has an incoming connection too? Cubby,Skydrive, video games, teamspeak etc? Why is my program different?

  • 0

Wouldn't I likely have something that has an incoming connection too? Cubby,Skydrive, video games, teamspeak etc? Why is my program different?

Your program is a server program. It sits and waits for an incoming connection on a specific port. If your router is blocking incoming connections, it's not going to work.

Client programs initiate the connection. First they connect to the server and negotiate the connection. Then the server can send a response, and you can do whatever you want.

In short, put the server somewhere you have control. At home, you can open the required ports on your router. And keep in mind that your ISP will block certain ports like 80.

  • Like 1
  • 0

no firewall

client ------------------>server : OK

with firewall blocking ports

client ------------|BLOCKED PORT| server : ERROR CANNOT CONNECT TO SERVER

^ lol, worst diagram I've seen today :D

But yeah, seems a certain someone doesn't fully grasp client/server connections...

  • 0

I was just wondering about this issue since Cubby Direct Sync works (maybe it's transferred through their server?) and how bit torrent will work, but not this little Java program.

They both use external servers/trackers to handle things. One thing to verify though, how are you connecting? If via the global IP, then you must use port forwarding as it is connecting to the schools router which would then have to know to forward the connection onward to the specified target. If using a local ip, well unless you are on the network it won't work.

Using cubby and such would connect to cubby servers which even if you don't remain connected to it, would be able to create the connection tunnel for any other services.

This topic is now closed to further replies.
  • Posts

    • They have done a good job. I have all the features dialed up in it.
    • Does your iPad support the latest iPadOS version? Here's the iPadOS 27 compatibility list by Aditya Tiwari Apple announced a ton of new updates and changes during its WWDC 2026 keynote. Of course, the center stage was captured by Apple Intelligence and the new upgraded Siri AI, which brings contextual awareness to Apple's voice assistant. This year's WWDC didn't have a dedicated section discussing what's new in iPadOS 27. That's probably because Apple has been unifying its software ecosystem in recent years through feature parity, changes to its naming scheme, and the Liquid Glass design language that spans all of its operating systems. That said, iPadOS 27 is coming later this year. Here are the iPad models present on the official list of supported devices: iPad Pro (M4 and later) iPad Pro 12.9-inch (4th generation and later) iPad Pro 11-inch (2nd generation and later) iPad Air 13-inch (M2 and later) iPad Air 11-inch (M2, M3, and M4) iPad Air 11-inch (4th generation and later) iPad (A16) iPad (9th generation and later) iPad mini (A17 Pro) iPad mini (6th generation and later) iPadOS 27 is now available as a developer beta release to try out the new features. To get the update on your supported model, go to Settings > General > Software Update > Beta Updates. Here, select "iOS 27 Developer Beta" from the options to get the latest update. In addition to iPadOS 27, you can try the developer beta versions of iOS 27, macOS 27, watchOS 27, tvOS 27, and HomePod software 27 on your supported devices. The newest iPad update shares many features with its siblings, including the Liquid Glass slider, performance improvements, an enhanced Flyover in Maps, an updated CPU scheduler, and more. Apple said during the keynote that browsing and transferring files from iPad to an external drive is up to 5x faster. Apple also announced a platter of child safety features and Screen Time updates, which are making their way to iPadOS 27 as well. Siri AI is supported on iPadOS, but the upgraded assistant won't be available in the EU due to DMA restrictions.
    • I do trust Apple probably more than these other companies with certain data, but I also do think (and it has been demonstrated that) Apple pulls a lot of shenanigans and always has for a long time.
    • Does your iPhone support the latest iOS version? Here's the iOS 27 compatibility list by Aditya Tiwari It's that time of year when we get to know about the latest operating system updates for Apple devices. For iPhone, Apple previewed the iOS 27 update at WWDC 2026, where the company finally introduced an upgraded version of Siri. Apple typically supports iPhone models for up to five years. But it has been making exceptions in recent years (read iPhone 11). If you're wondering whether your iPhone is compatible with the iOS 27 update, here is the official list of devices: iPhone 17 Pro Max, iPhone 17 Pro, iPhone 17, iPhone 17e, iPhone Air iPhone 16 Pro Max, iPhone 16 Pro, iPhone 16, iPhone 16 Plus, iPhone 16e iPhone 15 Pro Max, iPhone 15 Pro, iPhone 15 Plus, iPhone 15 iPhone 14 Pro Max, iPhone 14 Pro, iPhone 14 Plus, iPhone 14 iPhone 13 Pro Max, iPhone 13 Pro, iPhone 13, iPhone 13 mini iPhone 12 Pro Max, iPhone 12 Pro, iPhone 12, iPhone 12 mini iPhone 11 Pro Max, iPhone 11 Pro, iPhone 11 iPhone SE (2nd generation), iPhone SE (3rd generation) So, you can download the iOS 27 developer beta on up to 31 different iPhone models. There has been no change to the list of supported iPhones since iOS 26. However, it will expand to include more devices when the iPhone 18 series arrives later this year. To download the developer beta on your iPhone, go to Settings > General > Software Update > Beta Updates. Here, select "iOS 27 Developer Beta" from the list of choices to get the new update. In addition to iOS 27, you can try the developer beta versions of macOS 27, iPadOS 27, watchOS 27, tvOS 27, and HomePod software 27 on your supported devices. iOS 27 comes with improved Liquid Glass, which you can adjust using a new transparency slider. Apple said during the keynote that iPhone apps now launch up to 30% faster, new photos appear in the Photos app up to 70% faster, and AirDrop transfers work up to 80% faster. The new update promises to improve performance on older iPhones by introducing a new CPU Scheduler that supports devices all the way back to the iPhone 11. While iOS 27 is supported on older iPhones, it goes without saying that they'll lack several features due to hardware differences. For instance, iPhone 14/14 Plus and older models come with a notch instead of the Dynamic Island. Similarly, Apple Intelligence features are supported on iPhone 15 Pro/Pro Max and later models.
  • Recent Achievements

    • Experienced
      JayZJay went up a rank
      Experienced
    • Reacting Well
      Sir_Timbit earned a badge
      Reacting Well
    • Week One Done
      rubentuben8 earned a badge
      Week One Done
    • Week One Done
      ARaclen earned a badge
      Week One Done
    • Week One Done
      jojodbn earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      526
    2. 2
      PsYcHoKiLLa
      231
    3. 3
      +Edouard
      132
    4. 4
      ATLien_0
      88
    5. 5
      Steven P.
      83
  • Tell a friend

    Love Neowin? Tell a friend!