I'm developing a socket server/client application by JAVA for server and J2ME for client. Everything was ok when I tested the server in my windows XP. However, then, a serious problem occurred, when I deployed my socket server to server running Windows Server 2003. MY Windows server was lost network connection when my client tried to request a task that require server to send large data. The network connection on server was only saved if I unplugged network cable and plugged it again.
I searched solutions on the Internet and tried many ideas:
- refined code: opened and closed connection carefully in the 'finally' block; assigned the order in opening and closing In-OutStream; increased buffer-size; increased java heap size;
- reset & fixed Winsock of Server.
- declare listening IP for server (Well, my Windows Server has 2 IP: one for Local and other for Internet)
But, unfortunately, everything do not change. My server still die if it must send a large number of data.
Did anyone meet the problem like me? Or Do anyone have any idea for me?
Any help is appreciated.
I'd suggest the problem may not be in your Java program. However, to further troubleshoot, I suggest you create a binary search tree graph. Identify the test which can cut the problem area in half, and repeat.
I've seen one issue a long time ago, where large files couldn't be transfered because a terminator was removed from a 10-Base2 network. You could try transferring large files using other software like FTP, checking to make sure the transfer rate makes sense, etc..
You can use ping to send varying sized packets to the Windows 2003 host. You can run a client locally on the server and see if it has the same problem.
You could have a partially failed NIC, router, or ethernet cable. Such was the case at LAX a few years ago.
Related
Heyy guys. I'm writing a chat application in java, works pretty well. But can i somehow host my Server file or the Serversocket on the web? I want to make it so my friends from other pcs can use the client and connect to the server file which is hosted on the web. Is that possible? Can i host the File/socket online?
When you run a java application that opens a ServerSocket, it opens a port on your local machine and starts listening for incoming connections. What you do with those connections is up to the implementation of the java code that you write.
The "web" is much less foreign than you are making it out to be. Your own computer can be on the web that you're talking about and people can connect to your chat service. Or you can choose to host it on something like an AWS server.
The following approach is assuming you are behind a pretty standard NAT config.
Once you run your java application, you need to make sure other computers can see you, either inside your LAN or outside on the internet. You want to start testing from as close to your computer as possible, then start expanding outward.
First you need to make sure that your computer's firewall is actually allowing connections on the port that your java application is listening on.
Opening ports in the Windows Firewall
Setting up and opening ports in Linux
Now computers on your LAN will be able to connect to your java program. Now you need to go one layer out, and port forward your router. This is much less standard so I can't help you too much, but Google can.
At this point, anyone on this internet, knowing your external ip and what port your java application is listening, can connect to your service.
If you chose to host this on an third party hosting service, you'll need to go through similar steps, but there may be slight differences that you can either ask about, or again Google is a great resource.
I followed this article to create a java program for testing kerberos authentication: https://docs.oracle.com/javase/jndi/tutorial/ldap/security/gssapi.html
The only thing I changed were the configuration files.
The program works fine when I point the DNS settings of my windows client to my internal windows DNS/Kerb server but it times out when I use a separate public DNS server, even though:
1. My internal server has ports tcp/udp 88 open
2. My external server has the SRV records needed (_kerberos._tcp and _kerberos._udp on port 88)
3. I'm able to achieve kerberos authentication, with and without a user certificate, using my iPad which is not using my windows server's DNS
Both the iPad and my other clients are using the same network (my home wifi) and I've also tried by sharing out the data connection from my cell phone.
Given #3 above and the fact that the java program works from a client that uses my internal DNS, I'm a bit baffled as to why my java program wouldn't work in both scenarios (i.e. using the internal or external DNS server).
Do you have any suggestions?
From GitBook Hadoop and Kerberos: The Madness Beyond the Gate section Error Messages to Fear
Switching Kerberos to use TCP rather than UDP makes [some bizarre
issues] go away ... Note also UDP is a lot slower to time out ...
Kerberos waits ~90 seconds before timing out, which is a long time to
notice there's a problem ...
In /etc/krb5.conf
[libdefaults]
udp_preference_limit = 1
PS: the "~90 seconds before timing out" may refer specifically to the Java-specific defaults i.e.
kdc_timeout = 30000
max_retries = 3
Generally speaking, UDP seems to be a root cause for many weird Kerberos issues, cf. How to save Kerberos Service Ticket using a Windows Java client? for instance.
Disabling it systematically might be a "good practise".
I am using the example server and client from this website. I have the client on my laptop and the server on my other laptop.
When I run them the server doesn't receive anything. When I run the server and client on the same laptop (doesn't matter which one) the server is able to receive messages. What might be the problem here?
One laptop has W7 and the other W10
I suggest you test multicast connectivity between your two machines using an existing program (without programming anything in Java). Are they in the same subnet?
I haven't used multicast in the last 10 years, but a quick search yields many results.
I have 3 computers, on the same local network. Computer #1 is a TCP server and computers #2 and #3 are TCP Clients.
When the server starts I am trying to find the IP Addresses of all available clients automatically, so I don't need to enter the IP addresses manually.
I have limited networking experience, can someone please list the ways to do the above?
There are at least 2 ways:
Send a UDP Broadcast message to every computer on the network from server and clients will reply back their IP. This seems not ideal.
Somehow (not sure how) the server set's up a hostname, e.g. "http://localhost//myapp" and clients check every few seconds if the hostname is up and then connect to server. This seems to be implemented in Java RMI.
I am trying to archive my goal using the Java API if possible and avoid writing much code.
I am writing a platform game, and i thought it would be cool to add a multi-player mode for people who are playing on the same network. My question is how would i query through all the available computers open on a certain port for connecting to play multi-player, and then how would i establish a connection with them. I thought i could just create a socket and just try to connect on every port, but how would i do that if i dont know the other computer ip address. On google i saw this question get asked several times, however none of the answers actually seemed helpful.
You will propably want to broadcast a message (broadcasts are received by all devices on the network). Then you would have the other machines listening fir such incoming broadcasts.
Basically in a broadcast you would advertise that a computer is running the program, and is willing to establish a direct connection. Then one of the computers would connect straight to the other, and you would work on from there.
EDIT: Someones similarily done aproach in java (blog post)