Solved

how to send big file using sockets?

Posted on 2003-11-05
5
338 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 camera licenses with purchase of My Cloud NAS

Milestone Arcus software is compatible with thousands of industry-leading cameras for added flexibility. Upon installation on your My Cloud NAS, you will receive two (2) camera licenses already enabled in the software. And for a limited time, get additional camera licenses FREE.

Join & Write a Comment

What is IRC? IRC (Internet Relay Chat) is a form of communication between multiple users. It is available freely to anyone with inernet access. IRC is a great way to communicate with others e.g. There is an IRC channel for Ubuntu Linux, which is fo…
If your business is like most, chances are you still need to maintain a fax infrastructure for your staff. It’s hard to believe that a communication technology that was thriving in the mid-80s could still be an essential part of your team’s modern I…
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 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

15 Experts available now in Live!

Get 1:1 Help Now