Solved

how to send big file using sockets?

Posted on 2003-11-05
5
342 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

PRTG Network Monitor lets you monitor your bandwidth usage, so you know who is using up your bandwidth, and what they're using it for.
When it comes to security, there are always trade-offs between security and convenience/ease of administration. This article examines some of the main pros and cons of using key authentication vs password authentication for hosting an SFTP server.
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…
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…

809 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