Maysam Sorkhabi

Greenhorn
+ Follow
since Jul 13, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Maysam Sorkhabi

For a multi-threaded server wouldn't there be synchronization issues as to how the data received over each socket must be assembled to construct the original file being sent? From what I know, synchronizing threads for file access etc isn't exactly *simple*, a claim the posted exercise document makes. This was another reason of confusion for me.

Anyways thanks a bunch for your replies.
Well I'm not quite sure. What I posted previously is based on the text of the assignment which is as follows:


The objective of this lab. is to get familiar with TCP/IP and its UNIX interface, and then build the skeleton of a very simple file transfer system. The system should allow you to experimentally determine the best way of transferring a large file.

Recall that some modern file transfer programs allow you parallel downloads. So in general, you can transfer a file by using m parallel downloads. In fact each of these downloads can be done in n sequential parts. Assuming each chunk to be of equal size, you will transfer mn chunks, each of size file_size/mn. The parameters m,n determine the transfer schedule. You are free to choose the part of the file being transferred in each of these chunks; e.g., you can transfer the first 1/m fraction of the file over the first connection, and so on.

Note: In general, parallel downloads can take place from more than one server. For this assignment you can just use one server.

You should write a client/server application that does the following.

* The concurrent server program runs waiting for a connection from a client.
* The clients and the server should run on different machines.
* Each client asks the user for the name (path) of a file, and the transfer parameters m,n defined above. It then opens m TCP connections to the server and transfers the chunks (as you defined them) over the connections.
* Experiment with different m,n and provide guidelines (and rationale) for a good m,n that a user should use.
* This is meant to be a simple program, you probably will need to impose some limitations; that is fine, just state them clearly.
* You will lose points if your program does not close the sockets when the program quits.
* In order to prevent two students from using the same socket number on the same machine, you should use the socket number that is 2000 + x/2, where x is the last 4 digits of your student number (take floors if needed).
* You may use C/C++ or Java. Resources for network programming in either language are on the class page.
* Check the class page for clarifications etc.
* If this assignment piques your curiosity about P2P systems, you can see a very detailed tutorial here. We will cover some aspects of P2P systems later in the course.



Perhaps I'm not getting something or the requirements is not clear enough.
Hello masters,

I've heard when trying to send a big file over sockets, it is common practice to 'break up' the file into smaller parts and then send those over _multiple_ sockets/TCP connection simultaneously. Does this really speed things up? I must mention that the kind of architecture I have in mind does not involve the server running multiple threads. I merely want one server socket on the server and multiple client sockets. Does this even make sense? This is part of a networks course assignment and I just don't see it happening without threads . Your input is appreciated.
Thanks...although this only makes the text area expand horizontally but not vertically....any ideas?
15 years ago
Hello masters,

I'm wondering if it is possible for a JTextArea that is inside ScrollBars to adjust its size automatically as the main window is resized i.e. as the user expands the main window the JTextArea also expand to fill the extra space. I'm quite new to java gui.

Thanks
15 years ago
Hello,

I've read numerous times on the java tutorials that it is not wise to update GUI from threads other than the thread that the GUI is running on. I have developed applications that are multithreaded and occasioanly some of my threads update a GUI on a different thread. i.e. I initialize my working thread with the swing instance variables of the GUI thread. I indeed have noticed GUI freezes and crashes when the working thread encounters a problem or is performing a lenghty task. I am wondering what is the correct way of doing this? What the 'invokeLater' method do? How should it be used? Also what does it mean when it says component blah is "thread safe"...This is a general question so if you could just direct me to a more-concise-than-Sun's tutorial or something...Thanks so much
15 years ago
Oh my bad...Yeah that code I posted is not using Jakarta's package...sorry about that...As for setting the mode to binary each time a 'get' is performed..I never actually thought about that...Gonna try it sometime....Great idea david! Thank you very much.
Oh no Paul no need to be sorry...you people are the greatest on the net when it comes to java...
anyway...I swicthed to another FTP package developed by the Apache group called 'Jakarta' if I'm not mistaken, and it works pretty good except when I download a '.exe' file, say a program installer, I can't run it...



I can successfully download the file (Mozilla Firefox installer) but after download is complete I cannot run it..weird problem somewhere lol
If you're familiar with the porthole system in Gentoo Linux...I am actually trying to develop a similar mini-system for Windows where you open up this nice little program just enter the name of some software you're looking for...It downloads it, and runs it so you can do the rest (i.e. clicking Next-->Next-->Next until its installed lol). And well as you can see it's not going good...
anyway....thanks for your help!
OK. But now I'm getting a whole bunch of FileNotFound exceptions. Just how do you handle these filenames with spaces in between....?
Hi,
I'm running an experiment here wher I try to download a file from an ftp server using the sun.net.ftp.FtpClient package. Here is my code which fails with a TelnetProtocolException: Misplaced CR in input.




Any ideas why this is happening? Besides is there a good and free ftp library out there I can use intead of Sun's? Thanks
Hi,
I'd like to know how I can run native windows applications such as netstat.exe from java code. In particular I am interested in having a java GUI display the results of a command such as netstat -a. Does this invlove using the JNI interface? Your comments are much appreciated.
15 years ago
I'm not sure about this but I think if the socket abruptly disconnects it generates an exception, and you can catch that exception. Don't quote me on this tho. Check the API.
No Sir I really haven't. I was more thinking of some already implemented class\methods that would carry out this operation. But anyway thank for replying.
Hi there,
I share a cable connection in between two computers using a router. I'd like to write a little Java programs that constantly shows the bandwidth usage of each computer. i.e. I'd like to see how much data is uploaded over the cable connection from say my mom's computer. I'd like to have this as a little diagnostic tool. Any ideas about how this can be done?
Thanks

(p.s. I have some background in internet programing using Java, so feel free to go all out technical)
Hello all,
I have developed a chat client and now I'd like to add file transfer capability to it. Here are some of the thoughts I've had with respect to I should go about implementing this.

1. Do I need additional sockets ONLY for the sake of transfering files?(i.e. reading/writing to an extra socket)

2. Do I need additional threads to handle this task? If so, should I construct a new socket or I'd be better off with the URL/URLConnection classes?

Thank you very much for you're help.