Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Create file in java and write it to a different server on a different network

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a java application where I need to create a file, without an extension, in code and write it to a different server on another network. Our company currently is on 2 networks. Both servers are Windows. The server I need to write to will need a user name and password. What is the best way to do this? Examples would be helpful.
 
Ranch Hand
Posts: 152
VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do you get to that other server?

Socket connection?

Protocol?

Or do you have to implement the receiving end as well?
 
Craig Dumolien
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Protocol
 
Matt Cartwright
Ranch Hand
Posts: 152
VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What protocol?
 
Craig Dumolien
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was thinking I would just be able to use the file protocol. I'm not sure. We haven't done anything like this before. From what I've seen, I think I should be able to use a URL object with the file protocol and set my username and password as an authorization on the RequestProperty.
 
Marshal
Posts: 27288
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You say that a user name and password are going to be required, so I take that to mean that you won't have a drive mapped to that server on the machine where you're going to be creating this file.

So in that case a file:// URL isn't going to work because there isn't any way to find the target file on that source machine.

I have been using jCIFS for zapping files around Windows networks and it works just fine, even on computers which aren't running Windows.
 
Matt Cartwright
Ranch Hand
Posts: 152
VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:
I have been using jCIFS for zapping files around Windows networks and it works just fine, even on computers which aren't running Windows.



In that case the protocol would be SMB.
 
Craig Dumolien
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the point in the right direction. That worked great.
 
Paul Clapham
Marshal
Posts: 27288
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Matt Cartwright wrote:

Paul Clapham wrote:
I have been using jCIFS for zapping files around Windows networks and it works just fine, even on computers which aren't running Windows.



In that case the protocol would be SMB.



Correct. But in this case you don't have to go around begging for somebody to set up an "SMB server", as you might have to if you chose the FTP protocol. SMB is always-on in a Windows network.
 
reply
    Bookmark Topic Watch Topic
  • New Topic