Ad hoc network

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
charafe
Posts: 12
Joined: Tue Feb 06, 2007 7:32 pm

Ad hoc network

Post by charafe »

Hi,

I would like to know how to create a Ad hoc connection. What modules to use? Where to find the information about modules when we need something? do you know if there any tutorial on networks with the PSP?

thank you, all responses are welcome...

Rad
Rad
charafe
Posts: 12
Joined: Tue Feb 06, 2007 7:32 pm

Post by charafe »

[EDIT] I found something on http://psp-news.dcemu.co.uk/smsplus.shtml and there is the source code, i'll check tomorow...



Ok, I am answering myself:
What modules to use?
We have to look in utility Directory Reference.
There we can found different header that contains different functions for creating a connection.

Now I am trying to create a AD HOC network. So we have to load some modules:
the thing is that there is a module called ad hoc. But what is the difference btween PSP_NET_MODULE_ADHOC PSP_NET_MODULE_COMMON PSP_NET_MODULE_INET ? I don t know if somebody can answer me...

Then it is possible to do 2 different thing:
create a configure sceUtilityCreateNetParam
set the parameters with sceUtilitySetNetParam

But I don t know in which order to do,I tried both and had an error. If you have any information about this also it would be great.

Finally I found some other function such as:
sceUtilityNetconfInitStart
sceUtilityMsgDialogInitStart
and also all the file in the net directory...
The thing is that all these function do not have any documentation. So it is very difficult to understand what they do exactly... Once again, if you know how and where to find the info, it would be helpful.

Thank you for all your answers, I prefer that you say 10 times the same thing than never. You will find my function in the following:

Code: Select all

int adhoConnect()
{
int conf=1;
int check=0;
// pspUtilityNetconfData * data;
// SceUtilityMsgDialogParams *params
// 
// 
// pspDebugScreenClear();
// 
// sceUtilityNetconfInitStart(data);
// sceUtilityMsgDialogInitStart (params);  
 if&#40;sceUtilityLoadNetModule&#40;PSP_NET_MODULE_ADHOC&#41;<0&#41;
	&#123;
		printf&#40;"Error loading AD HOC module\n"&#41;;
		return 1;
	&#125;
else printf&#40;"AD HOC Module loaded\n"&#41;;
if&#40;sceUtilityLoadNetModule&#40;PSP_NET_MODULE_COMMON&#41;<0&#41;
	&#123;
		printf&#40;"Error loading COMMON module\n"&#41;;
		return 1;
	&#125;
else printf&#40;"COMMON Module loaded\n"&#41;;
if&#40;sceUtilityLoadNetModule&#40;PSP_NET_MODULE_INET&#41;<0&#41;
	&#123;
		printf&#40;"Error loading INET module\n"&#41;;
		return 1;
	&#125;
else printf&#40;"INET Module loaded\n"&#41;;



if&#40; sceUtilitySetNetParam&#40;PSP_NETPARAM_NAME,"Adhoc1"&#41; !=0&#41;&#123;
		printf&#40;"Error setting LAN parameters\n"&#41;;
		return 1;
	&#125;
else printf&#40;"LAN parameters set\n"&#41;;
if&#40; sceUtilitySetNetParam&#40;PSP_NETPARAM_SSID,"Comet"&#41; !=0&#41;&#123;
		printf&#40;"Error setting LAN parameters\n"&#41;;
		return 1;
	&#125;
else printf&#40;"LAN parameters set\n"&#41;;
//check+=sceUtilitySetNetParam&#40;PSP_NETPARAM_IS_STATIC_IP,1&#41;;
if&#40; sceUtilitySetNetParam&#40;PSP_NETPARAM_IP,"192.168.1.1"&#41; !=0&#41;&#123;
		printf&#40;"Error setting LAN parameters\n"&#41;;
		return 1;
	&#125;
else printf&#40;"LAN parameters set\n"&#41;;
if&#40; sceUtilitySetNetParam&#40;PSP_NETPARAM_NETMASK,"255.255.255.0"&#41; !=0&#41;&#123;
		printf&#40;"Error setting LAN parameters\n"&#41;;
		return 1;
	&#125;
else printf&#40;"LAN parameters set\n"&#41;;

if&#40;check!=0&#41; &#123;
		printf&#40;"Error setting LAN parameters\n"&#41;;
		return 1;
	&#125;
else printf&#40;"LAN parameters set\n"&#41;;
 if&#40;sceUtilityCheckNetParam&#40;conf&#41;!=0&#41;
	&#123;
		printf&#40;"Error in LAN parameters\n"&#41;;
		return 1;
	&#125;
else printf&#40;"LAN parameters checked\n"&#41;;
if&#40;sceUtilityCreateNetParam&#40;conf&#41;!=0&#41;
	&#123;
		printf&#40;"Error creating configuration\n"&#41;;
		return 1;
	&#125;
else &#123;
	printf&#40;"LAN parameters set with success!!!\n"&#41;;
	&#125;



sceUtilityUnloadNetModule&#40;PSP_NET_MODULE_ADHOC&#41;;
sceDisplayWaitVblankStart&#40;&#41;;
return 0;
&#125;

Rad
PspPet
Posts: 210
Joined: Wed Mar 30, 2005 2:13 am
Contact:

Post by PspPet »

Please read this thread:

http://forums.ps2dev.org/viewtopic.php?t=2471

The regular PSP internet APIs and sample code will work just as well for a WiFi 'adhoc' connection between two PSPs or a PSP and another WiFi device.

You have to set it up for a non-DHCP connection etc. You can do this with the standard Network settings options (no custom programming required).

Communication will be TCP/IP or UDP/IP just like normal.

Ignore anything related to the PSP game-sharing adhoc mode. That's used in PSP->PSP game communication for commercial games, but is not well documented and not useful for homebrew.
Post Reply