DHCP Server ?

Everything else that doesn't fall into one of the other PB categories.
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

DHCP Server ?

Post by Progi1984 »

Do you think that it's possible to code a DHCP server in PureBasic ?
User avatar
Michael Vogel
Addict
Addict
Posts: 2820
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: DHCP Server ?

Post by Michael Vogel »

Progi1984 wrote:Do you think that it's possible to code a DHCP server in PureBasic ?
Think so, but I think it will not be easy to do that platform independent - so in what OS should it run?

All I did is to send and receive ICMP packets to do a network scan with windows - this can be done by API calls, but as I know, "self defined packets" can't be done (easily) with standard winsock. Maybe someone else has already read the available documentation of winsock?!
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Post by Progi1984 »

Is it not possible to do that with purebasic commands ?
User avatar
Michael Vogel
Addict
Addict
Posts: 2820
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Post by Michael Vogel »

Progi1984 wrote:Is it not possible to do that with purebasic commands ?
No, just have a look into the Network Commands of PureBasic - more than in other languages, but still only for simple things (get own ip addresses, etc.) and special commands for doing a client server relation between two PureBasic programs (network games, etc.).

If doing advanced things, it can still be a possibility which is not too complicate, if you know how to do the API calls or the call for a certain DLL. For instance, the following lines are still PureBasic commands, if you want - but they call the windows API for doing a "ping"...

Code: Select all

	ResultSize = SizeOf(ICMP_ECHO_REPLY)+Len(Packet); anstelle von Len(Message)
	*Result = AllocateMemory(ResultSize)
	*Echo.ICMP_ECHO_REPLY = *Result

	If IpAddress <> 0
		hFile = IcmpCreateFile_()
		If IcmpSendEcho_(hFile, IpAddress, Packet, Len(Packet), 0, *Result, ResultSize, Timeout) > 0
			Ergebnis=*Echo\RoundTripTime
		Else
			Ergebnis=-1
		EndIf
		IcmpCloseHandle_(hFile)
	Else
		Ergebnis=-2
	EndIf

	FreeMemory(*Result)
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

Vogel is right on the dot. The server side aspect of PB is great for simple things, but its not complete.
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

I don't consider ICMP packtes something which is really needed for normal software, but you are right there are problems in the network lib nevertheless, we even have examples that show that you can write an ICQ Client in Purebasic which indeed is advanced. A DHCP Server though needs API since it needs IMHO commands which are very raely usefull in normal applications even in Network ones.
Post Reply