Hi everyone,
I'm trying to replicate a bittorrent program using Linux client/server programming. I have a few questions on how to approach this..
1) If I write a client/server program, can it be merged together? Usually bittorrent programs can send/receive files
2) Doing it step by step, I would like to send a file from the server to the client. Problem is, how can I find out the name of the file that I am trying to send from the server to the client? For example, image.jpg.
3) I've tried sending a flat file over, say textfile.txt, but on the client side it appends some junk character at the end of it. What causes the characters to appear?
That's the questions I have for now. Will post more if it comes up. Thanks!
---------- Post updated at 12:35 PM ---------- Previous update was at 11:28 AM ----------
Hmm I fixed the junk character appending, but somehow it only works when sending txt files from client to server. Sending any image files, results in a smaller, corrupted file for some reason.
Client code:
In the client side, sock is the socket, while fw is the file to write to (eg: image.gif)
Server code:
In the server, fw is the file to read from (eg: image.gif), and fd is the socket to write to.
You need to send the file size before sending actual file. Because this is binary data, you MUST NOT treat this as string data.
Also while reading/writing you should check how bytes has been actually read/written. Based on this you should move your read/write point. e.g. while writing it should be
Hi all,
Earlier today, I read an article on how to detect BitTorrent traffic using tshark (the cli version of Wireshark).
I wanted to have a go at creating a simple script, that when BitTorrent packets are detected the network connection will be throttled. The thing is that I am not great at... (1 Reply)
I created a program, so a kid can practice there math on it. It dispenses varies math problems and the kid must input an answer. I also want it to grade the work they have done, but I can't find the best place for it to print out the grade.
I have:
if ( $response =~ m/^/ ) {
$user_wants_to_quit... (1 Reply)
Long story short: I'm working inside of a Unix SSH under a bash shell. I have to code a C program that generates a random number. Then I have to call the compiled C program with a Perl program to run the C program 20 times and put all the generated random #s into a text file, then print that text... (1 Reply)
I wrote a simple program that generates a random word 10,000,000 times.
I wrote it in python, then in C++ and compared the two completion times. The python script was faster! Is that normal? Why would the python script be faster? I was under the impression that C++ was faster. What are some of... (2 Replies)
Hi. I ran nmap on my server, and I get the following:
Starting Nmap 4.76 ( http://nmap.org ) at 2009-03-19 16:33 EDT
Interesting ports on -------- (-----):
Not shown: 997 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
6881/tcp open bittorrent-tracker
The... (0 Replies)
Hi,
i want to write a script that executes a program (exec?) .
this program then requires a filename as input.
how do i give it this input in the script so the program will be complete run and close by the script.
e.g.
exec prog.exe
program then asks for filename
"enter filename:"... (1 Reply)
Hi,
I'm behind a university firewall where nearly all ports are blocked. Therefore I've set up a ssh tunnel to my comp at home so that I can bypass the uni firewall and use bittorrent. I used mainly these 3 guides to setup the tunnel: http://freebsdcluster.org/~lasse/sshazureustunnel/ , Whalesalad... (1 Reply)
Due to the massive Upload speeds killing .... or overstressing our schools network...... my school has blocked port 6969 (the most common BitTorrent port). So I cant connect to the tracker anymore, in other words no more downloading from school :(
Does anyone know how I can get around the ports... (1 Reply)