Solved

how to send big file using sockets?

Posted on 2003-11-05
5
340 Views
Last Modified: 2006-11-17
how can i send a big file from one pc to another using sockets in java? Also how to verify it without opening at other side whether it is transferred correctly or not?
0
Comment
Question by:panemade
  • 3
  • 2
5 Comments
 
LVL 45

Expert Comment

by:sunnycoder
ID: 9685723
Hi panemade,

>how can i send a big file from one pc to another using sockets
divide it into smaller parts (fragmentation) and send it part by part ... at the receiving end, join all the parts to get the complete file.

>Also how to verify it without opening at other side whether it is transferred correctly or not?
look into checksums .... anyway if you are using reliable protocol such as TCP, you would have received the file correctly ... it performs the required tests

Cheers!
Sunny:o)
0
 
LVL 1

Author Comment

by:panemade
ID: 10171515
can u give me some hint code or actual code to help to send a file using fragments?
 also how to join all fragments at receiveing end?
0
 
LVL 45

Accepted Solution

by:
sunnycoder earned 50 total points
ID: 10171555
skeleton ::

sender ::::
socket ()
connect()
fopen()
while ( fread ( ..n.. ) .. )
        send ( ..n.. )
send ( some special marker seqence indicating end of transfer )
fclose()
close()

receiver:::
socket()
bind()
listen()
accept()
fopen
whille ( not received marker sequence )
      recv()
     fwrite()
fclose()
close()
0
 
LVL 1

Author Comment

by:panemade
ID: 10171769
thats is great hint for me. so tell me one more thing to send a data on linux is it require a ip address of that computer? is it will not work only with name of that computer to send a data as dhcp assign it ip address that is not satic on my computer network?
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 10171797
use gethostbyname() to get IP address at run time
http://www.ecst.csuchico.edu/~beej/guide/net/html/syscalls.html#gethostname

you will find this tutorial very educative
http://www.ecst.csuchico.edu/~beej/guide/net/html/
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

#Citrix #Citrix Netscaler #HTTP Compression #Load Balance
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now