Go Back   nV News Forums > Software Forums > Software Development

Newegg Daily Deals

Reply
 
Thread Tools
Old 09-09-07, 04:44 PM   #1
Tuork
Official pain in the ass
 
Tuork's Avatar
 
Join Date: May 2003
Location: 127.0.0.1
Posts: 1,197
Send a message via MSN to Tuork
Default How to split a file into packets.

Hello everyone.
I have a networking assignment in which I have to transfer a file in groups of 8 256byte-packages, using JAVA.

Anyone know how I can break the file into the packages so I can send them through a socket connection?

Moreso, anyone have any ideas on how to implement a buffer on the serverside?

Any help is greatly appreciated.
__________________
My avatar: "An obscure and non sensical pattern made to get people to post what they think it is" - Vamp

Dimitri:
Dell XPS M1530
Core2Duo T5550 1.86Ghz | 3GB DDR2 | 8600M GT 256MB | 250GB Hdd | BenQ FP202W 20" LCD | MX1000 mouse | Inspire T5400 5.1
Tuork is offline   Reply With Quote
Old 09-09-07, 06:44 PM   #2
bugmeplz
*BANNED*
 
bugmeplz's Avatar
 
Join Date: Sep 2006
Posts: 427
Default Re: How to split a file into packets.

hi, you can just use FileInputStream to read in the raw bytes from the file you're trying to send to the server. You can use the FileInputStream to read in groups of 256 bytes, and then send them over to the socket on the server end. I am not sure what you mean regarding "how to implement a buffer on the serverside"; it can just be a byte[] that you fill up with the raw bytes sent over from the client. let me know if you have any more questions

BTW: it is rather confusing to use the term "package" since this has a definite meaning in java's jargon
bugmeplz is offline   Reply With Quote
Old 09-12-07, 07:00 AM   #3
Tuork
Official pain in the ass
 
Tuork's Avatar
 
Join Date: May 2003
Location: 127.0.0.1
Posts: 1,197
Send a message via MSN to Tuork
Default Re: How to split a file into packets.

Quote:
Originally Posted by bugmeplz
hi, you can just use FileInputStream to read in the raw bytes from the file you're trying to send to the server. You can use the FileInputStream to read in groups of 256 bytes, and then send them over to the socket on the server end. I am not sure what you mean regarding "how to implement a buffer on the serverside"; it can just be a byte[] that you fill up with the raw bytes sent over from the client. let me know if you have any more questions

BTW: it is rather confusing to use the term "package" since this has a definite meaning in java's jargon
Thanks for the reply.

I did in fact use the InputStream to read raw bytes... same goes for what you mentioned about the buffer.

As for the packet deal, it was just the wording on my assignment that threw me off. What they meant was that I was supposed to send a certain amount of bytes per transmission.

Thanks a bunch!
__________________
My avatar: "An obscure and non sensical pattern made to get people to post what they think it is" - Vamp

Dimitri:
Dell XPS M1530
Core2Duo T5550 1.86Ghz | 3GB DDR2 | 8600M GT 256MB | 250GB Hdd | BenQ FP202W 20" LCD | MX1000 mouse | Inspire T5400 5.1
Tuork is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
The Rise of Object-based File Systems for HPC News Archived News Items 0 05-09-12 01:10 PM
RPM Source problems LaoTzuTao NVIDIA Linux 10 01-19-03 05:15 AM
Can't install NVIDIA_kernel.XXXX.XXXX.src or regular rpm noeffort NVIDIA Linux 15 12-17-02 01:22 PM
WHQL certification:Which file is responsible for ? cenkog NVIDIA Windows Graphics Drivers 1 10-06-02 09:33 PM
Where is my log file? Frink NVIDIA Linux 20 09-19-02 09:59 PM

All times are GMT -5. The time now is 11:23 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.