Win a copy of Java XML & JSON this week in the XML and Related Technologies 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Android Java P2P File Sharing  RSS feed

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys. I'm trying to build an file sharing app using p2p connection but  I don't know how to send the file. I'm done with the server/client connection and really need help with the file sending part. Please help.
 
Saloon Keeper
Posts: 5219
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it P2P or client /server? It's either one or the other.

P2P is probably not possible, since devices can't connect to one another on mobile networks.
 
Jason Alexander
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sorry, it's host/client not server/client  
I just need help with the file.
I converted it to base64 string then split the string to bytes because there's a limit in how much bytes you can send.
I know the process but I can't code it  
 
Tim Moores
Saloon Keeper
Posts: 5219
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what the difference between host/client and client/server is supposed to be, but either way- it's not P2P :-)

Post the relevant code of what you have so far, so we can see what's still missing.
 
Jason Alexander
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using wifi-direct.

right now the program only sends short messages.

 
Jason Alexander
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Tim Moores
Saloon Keeper
Posts: 5219
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code looks like you can use it to send byte arrays. Since a file can be represented as a byte array, what's stopping you from sending files?
 
Jason Alexander
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sorry. I know the concept I don't know how to code it. So I turn the file into a byte array so I can split it so that I can send it bits by bits then on the receiver side I just compile those bits right? First I send the file name then the file length then compile it to an outputstream but I don't know how  to code that
 
You didn't tell me he was so big. Unlike this tiny ad:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!