Solved

how to send big file using sockets?

Posted on 2003-11-05
5
345 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Most of the applications these days are on Cloud. Cloud is ubiquitous with many service providers in the market. Since it has many benefits such as cost reduction, software updates, remote access, disaster recovery and much more.
This article is in regards to the Cisco QSFP-4SFP10G-CU1M cables, which are designed to uplink/downlink 40GB ports to 10GB SFP ports. I recently experienced this and found very little configuration documentation on how these are supposed to be confi…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Suggested Courses
Course of the Month6 days, 3 hours left to enroll

626 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