Connection issue to new Samsung S9

I have a new Samsung Galaxy S9 which replaces a Samsung Galaxy S6 and I have two issues which are probably connected:

a) I cannot use the App "Wifi File Transfer Pro" - when I launch the App on the phone it gives an IP address to enter into my browser on the PC, but when I enter this address it will not bring up the page - the connection eventually times out; on the Galaxy S6 this works perfectly

b) I have an app I have written in Java which has components running on the phone and my PC, which I use for transferring various files between the phone and my PC - again this has worked perfectly for many years on the Galaxy S6, but on the S9 it fails to connect:  the phone component successfully wakes up the PC component which does its thing and then tries to connect to send the result, but the java command connection=new Socket(host, PORT) times out with the error message " Connection timed out: connect"

It looks like a firewall issue, but it's not the firewall on my PC since I've tried disabling that temporarily.   It may be a firewall issue on the Samsung S9 but I can't see how to configure that.   I've tried tweaking the Setting "Phone visibility" but that doesn't seem to solve the issue.

Any thoughts?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

fred hakimRetired ITCommented:
I have a galaxy s8active and I noted it now requires me to tap allow on the phone for access to data, when i connect with my PC.  It might also be some security hoop for your method of connecting as well.  There might be a setting somewhere to turn these  off.
DavidRMasonAuthor Commented:
Fred  - thanks for the comment.   I too get a prompt when I have a wired connection, but these are connecting via Wifi.   There might indeed be a setting somewhere - I hope there is - but I've had a thorough look and can't find anything that looks relevant.
DavidRMasonAuthor Commented:
Further to my question, I've attached the new device to my PC in developer mode using ADB and identified that the program stalls in the following lines of code running on the phone:
                                       DatagramSocket socket=new DatagramSocket();
                              byte[] data=(requestCode+androidid).getBytes();
                              DatagramPacket packet=new DatagramPacket(data,data.length,broadcastAddress,datagramPort);
                              byte[] reply=new byte[MAX_SIZE];
                              DatagramPacket replyPacket=new DatagramPacket(reply,reply.length);
The program successfully executes the socket.send command but never returns from the socket.receive command - thus something is blocking the reply packet.   On my old phone this code has been running trouble free for many months.   I've confirmed on the PC side that the packet sent is successfully received.
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

DavidRMasonAuthor Commented:
I found this article: which looks relevant

Adding the line socket.setBroadcast(true) enables the code to progress beyond the stage above and establish basic datagram connectivity, which my program uses to find the server and exchange basic information to enable the connection for file transfer to be established.

There must be something similar to enable the file transfer to work, but still looking.
DavidRMasonAuthor Commented:
Further to this - I cleaned the code and restarted and it now works.  

The solultion was to add the line:


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
fred hakimRetired ITCommented:
glad to hear that, I hadn't been able to find much to help you.
DavidRMasonAuthor Commented:
Finding the right search in Google to locate the relevant article - the key was to determine that the source of the problem was inability to send a datagram and including the word "datagram" in the search.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Smartphone Programming

From novice to tech pro — start learning today.