Speed I really can provide

Archived discussion about features (predating the use of Bugzilla as a bug and feature tracker)

Moderator: Moderators

Locked
X_a_v_i
Posts: 2
Joined: 2004-04-23 18:49

Speed I really can provide

Post by X_a_v_i » 2004-04-26 17:27

Is it possible to fight those people who don't write truth about their speed with such a feature, that would check real speed of download/upload, everything during using, without any possibility of change made by user ???

YES

---------------------------------------------------------------------------
#include <stdio.h>
#include <conio.h>
#include <afxinet.h>
#include <wininet.h>


main()
{
int hora,horafinal,final,abits,conexion,cs;
printf("hit 1 if modem and 0 if better: ");
scanf("%d",&cs);
fflush(stdin);


HINTERNET hSession;
hSession = InternetOpen("MyApp", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);

if (hSession)
{
HINTERNET hService;
hService = InternetConnect(hSession, "ftp.idsoftware.com",
INTERNET_DEFAULT_FTP_PORT, "anonymous", "[email protected]",
INTERNET_SERVICE_FTP, 0, 0);

if (hService)
{

CTime date(CTime::GetCurrentTime());
hora = date.GetTime();

BOOL gFile;
if (cs=0)
{
gFile = FtpGetFile(hService, "/idstuff/source/q2source-3.21.zip", "c:/deleteme.txt", 0, 0, FTP_TRANSFER_TYPE_BINARY, 0);
}
else
{
gFile = FtpGetFile(hService, "/idstuff/source/doomsrc.zip", "c:/d.txt", 0, 0, FTP_TRANSFER_TYPE_BINARY, 0);
}
DWORD error_no = GetLastError();
if (cs=0)
{
CTime da(CTime::GetCurrentTime());
horafinal = da.GetTime();
final=horafinal-hora;
abits=1477764*8;
conexion=abits/final;
}
else
{
CTime da(CTime::GetCurrentTime());
horafinal = da.GetTime();
final=horafinal-hora;
abits=362698*8;
conexion=abits/final;
}

}

InternetCloseHandle(hService);
}


InternetCloseHandle(hSession);

//printf(final);
printf("connection speed: ");
printf("%i bps ",conexion);


}
------------------------------------------------------------------------------
compile with : project settings>>C/C++ category:code generation >> use run time library=debug multythreaded

cologic
Programmer
Posts: 337
Joined: 2003-01-06 13:32
Contact:

Post by cologic » 2004-04-26 18:11

Grrrr.

If you're going to post code to a forum, do so in a form that maintains indentation. It looks fucking awful otherwise.

Just some venting from seeing years of this stuff.

IntraDream
Posts: 32
Joined: 2003-12-12 14:28
Location: FL,USA
Contact:

Post by IntraDream » 2004-04-26 18:16

I dont know c but im guessing that code connects to an ftp and downloads a file and returns the speed of the download. WOW what a horible way to judge speed. for one theres no upload test from what i can tell wich would be the thing really that would be good to know and there is also way to many factors. for 1 do you know how many people use dc++ what if 50 people with 500KB/s download run that 'test' at the same time. even if that where fixable through some queuing system this in my opinion would still be quite useless.

Tim-

Todi
Forum Moderator
Posts: 699
Joined: 2003-03-04 12:16
Contact:

Post by Todi » 2004-04-26 18:19

It does seem like you're downloading something.. Hrm.. Ever heard of DSL? Download speed means 0 on a p2p network, atleast not for anyone but you.

cologic
Programmer
Posts: 337
Joined: 2003-01-06 13:32
Contact:

Re: Speed I really can provide

Post by cologic » 2004-04-26 18:22

What I mean:

Code: Select all

#include <stdio.h>
#include <conio.h>
#include <afxinet.h>
#include <wininet.h>


main()
{		
		int hora,horafinal,final,abits,conexion,cs;
		printf("hit 1 if modem and 0 if better: ");
		scanf("%d",&cs);
		fflush(stdin);
		
			
			HINTERNET hSession;
			hSession = InternetOpen("MyApp", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);

			if (hSession)
			{
				HINTERNET hService;
				hService = InternetConnect(hSession, "ftp.idsoftware.com", 
							INTERNET_DEFAULT_FTP_PORT, "anonymous", "[email protected]", 
							INTERNET_SERVICE_FTP, 0, 0);
	
					if (hService)
					{
					
						CTime date(CTime::GetCurrentTime());
						hora  = date.GetTime();
						
						BOOL gFile;
						if (cs=0)
						{
							gFile = FtpGetFile(hService, "/idstuff/source/q2source-3.21.zip", "c:/deleteme.txt", 0, 0, FTP_TRANSFER_TYPE_BINARY, 0);
						}
						else
						{
							gFile = FtpGetFile(hService, "/idstuff/source/doomsrc.zip", "c:/d.txt", 0, 0, FTP_TRANSFER_TYPE_BINARY, 0);
						}
						DWORD error_no = GetLastError();
						if (cs=0)
						{
						CTime  da(CTime::GetCurrentTime());
						horafinal  = da.GetTime();
						final=horafinal-hora;
						abits=1477764*8;
						conexion=abits/final;
						}
						else
						{
						CTime  da(CTime::GetCurrentTime());
						horafinal  = da.GetTime();
						final=horafinal-hora;
						abits=362698*8;
						conexion=abits/final;
						}
						
					}
			
			 InternetCloseHandle(hService);
			}

  
		  InternetCloseHandle(hSession);
 		  
		  //printf(final);
		  printf("connection speed: ");
		  printf("%i bps ",conexion);
		
		
}

X_a_v_i
Posts: 2
Joined: 2004-04-23 18:49

Post by X_a_v_i » 2004-04-26 18:35

it`s only an idea. yeah! the code could be modified to uploading.

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2004-04-26 20:53

If you're going to do something this wasteful, at least use someone else's code.

Sourceforge hosts a similar one, with some sources in Sweden providing bandwidth. I can't find the exact URL in my chat logs, unfortunately.

Qbert
Posts: 73
Joined: 2003-06-07 03:12

Post by Qbert » 2004-04-26 23:39

I personally think this would end up being a waste of time, and most of the time the information would be completely unreliable.
At least don't reinvent the wheel though. http://www.ncne.org/software/tools/tcp.html
My Visual Studio .NET 2003 is licensed under my name, and the same for my operating system... What about you?
I surf on an OC3 without limitations, two to be exact, and I'm not joking.

dpm
Posts: 10
Joined: 2004-03-30 22:40

That's a pretty big if...

Post by dpm » 2004-04-27 12:38

This would never work. I can provide speeds of 800k/s+ to users on the hub that I run on my local university network. IF I were to connect to other hubs, CIS has this nice 'feature' called 'packetshaping.' So I'd be uploading/downloading to public hubs at a measly 2k/s

Maybe we need an option that says:
OC3 Connection, but CIS (or IT) sucks ass.

Twink
Posts: 436
Joined: 2003-03-31 23:31
Location: New Zealand

Post by Twink » 2004-04-27 18:21

besides, if I wanted to be mean I could just make sure I have another file transfering when I start up dc++ so this test makes it look like I have less bw then I really do.

Locked