<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Simple Network connection</title>
<description> Hi, i was wondering if someone could help me with this. only thing i really need, is a simple class to initilize a connect TO a server. i took a look at the sockettest example, and its very confusing to read as theres not many comments or explainations for whats bieng done. the example works, but the wii app waits for a connection FROM another device, but i want to connect TO another device. i more or less understand how to use the net_send/net_recv functions, but its the setting up of the connect im having trouble.

- BurningMan</description><link>http://forum.wiibrew.org/read.php?11,61983,61983#msg-61983</link><lastBuildDate>Mon, 07 Sep 2026 19:53:37 +0200</lastBuildDate>
<generator>Phorum 5.2.23</generator>
<item>
<guid>http://forum.wiibrew.org/read.php?11,61983,62900#msg-62900</guid>
<title>Re: Simple Network connection</title><link>http://forum.wiibrew.org/read.php?11,61983,62900#msg-62900</link><description><![CDATA[ Are you sure your computer is actually connecting? I know I&#039;ve had trouble before with connect exiting before it actually connects. Then it seems like it connects, but it really doesn&#039;t, leaving your wii without anything to connect to.<br />Make sure your connect function on your PC server looks something like this:<br /><pre class="bbcode">
if(listen(mySocket,1)!=SOCKET_ERROR){	//Listen and wait for incoming connections, 1 backlog
	newConnection = accept(mySocket,NULL,NULL);
        
        // Your Code Here
}
</pre>]]></description>
<dc:creator>g_man</dc:creator>
<category>Coding</category><pubDate>Thu, 09 Dec 2010 00:17:50 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,61983,62887#msg-62887</guid>
<title>Re: Simple Network connection</title><link>http://forum.wiibrew.org/read.php?11,61983,62887#msg-62887</link><description><![CDATA[ You shouldn&#039;t be checking if net_connect returns -1 for failure, you should be checking if it returns &lt;0. Libogc&#039;s networking functions return error status directly rather than setting errno and returning -1.]]></description>
<dc:creator>tueidj</dc:creator>
<category>Coding</category><pubDate>Wed, 08 Dec 2010 08:10:04 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,61983,62885#msg-62885</guid>
<title>Re: Simple Network connection</title><link>http://forum.wiibrew.org/read.php?11,61983,62885#msg-62885</link><description><![CDATA[ im still not having any luck with getting the wii to connect to my server app. ive used the same for a windows console app (with some exceptions WINSOCK shit) but all in all its the same code, and the windows code connects, but the wii version wont. it says it connects, no errors or anything, but the server app doesnt acknowledge that there was a connection.]]></description>
<dc:creator>burningman</dc:creator>
<category>Coding</category><pubDate>Wed, 08 Dec 2010 05:49:13 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,61983,62118#msg-62118</guid>
<title>Re: Simple Network connection</title><link>http://forum.wiibrew.org/read.php?11,61983,62118#msg-62118</link><description><![CDATA[ ok, it somewhat works now. i run it in the dolphin emu and now it says &#039;error connecting&#039; and says &#039;connected&#039; on the real wii but the server pc app still doesnt seem to acknowledge that a connection was made. might be the server app though. will have to take a look at the code for that. thanks for the info for the wii stuff though.]]></description>
<dc:creator>burningman</dc:creator>
<category>Coding</category><pubDate>Sun, 14 Nov 2010 21:01:28 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,61983,62117#msg-62117</guid>
<title>Re: Simple Network connection</title><link>http://forum.wiibrew.org/read.php?11,61983,62117#msg-62117</link><description><![CDATA[ if_config() returns those values for you.<br /><br />Something like :<br /><br /><pre class="bbcode">
char            localip[16];
char            gateway[16];
char            netmask[16];

if (if_config ( localip, netmask, gateway, TRUE) &lt; 0)
{
  // Error
  return;
}

printf("My local IP is %s, the netmask is %s and the gateway is %s\n",localip, netmask, gateway);

</pre>]]></description>
<dc:creator>scanff</dc:creator>
<category>Coding</category><pubDate>Sun, 14 Nov 2010 20:01:17 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,61983,62111#msg-62111</guid>
<title>Re: Simple Network connection</title><link>http://forum.wiibrew.org/read.php?11,61983,62111#msg-62111</link><description><![CDATA[ i took a look at that code. i added the if_config(), but i was curious, do i pass it the localip and such or does it return those values. i might have missed it but i didnt see anything that would return the localip and such.]]></description>
<dc:creator>burningman</dc:creator>
<category>Coding</category><pubDate>Sun, 14 Nov 2010 14:21:04 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,61983,62077#msg-62077</guid>
<title>Re: Simple Network connection</title><link>http://forum.wiibrew.org/read.php?11,61983,62077#msg-62077</link><description><![CDATA[ Take a look at the client stub from WiiRadio. We wrote it to work on Linux, Windows and Wii so there are ifdef&#039;s. It seems to work pretty well.<br /><br />[<a href="http://code.google.com/p/wiiradio/source/browse/trunk/source/client.h" rel="nofollow">code.google.com</a>]<br /><br />Edit -<br /><br />P.S.<br /><br />On Wii before any network stuff you need to call if_config(). Unless it&#039;s been changed recently.]]></description>
<dc:creator>scanff</dc:creator>
<category>Coding</category><pubDate>Sat, 13 Nov 2010 20:57:50 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,61983,62055#msg-62055</guid>
<title>Re: Simple Network connection</title><link>http://forum.wiibrew.org/read.php?11,61983,62055#msg-62055</link><description><![CDATA[ put the connect part in a while loop until it connects]]></description>
<dc:creator>g_man</dc:creator>
<category>Coding</category><pubDate>Sat, 13 Nov 2010 07:07:50 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,61983,62053#msg-62053</guid>
<title>Re: Simple Network connection</title><link>http://forum.wiibrew.org/read.php?11,61983,62053#msg-62053</link><description><![CDATA[ <pre class="bbcode">
int initnet(char *address,int port,char data[256])
{

	int sockd;
	int count;
	struct sockaddr_in serv_name;
	char buf[MAX_BUF];
	int status;
	
	/* create a socket */
	sockd = net_socket(AF_INET, SOCK_STREAM, 0);
	
	if (sockd == -1)
	{
		//perror("Socket creation");
		return -1;
	}
	
	/* server address */ 
	serv_name.sin_family = AF_INET;
	//inet_aton(argv[1], &serv_name.sin_addr);
	inet_aton(address, &serv_name.sin_addr);
	serv_name.sin_port = port;//htons(atoi(argv[2]));
	
	/* connect to the server */ 
	status = net_connect(sockd, (struct sockaddr*)&serv_name, sizeof(serv_name));
	if (status == -1) 
	{ 
		//perror("Connection error"); 
		return -1; 
	}
	
	//count = net_read(sockd, buf, MAX_BUF);
	//count=data.length();
	count=strlen(data);
	//net_write(sockd, data, count);
	net_send(sockd, data, strlen(data)+1, MSG_DONTWAIT);
	close(sockd);
	
	return 0;
}
</pre>]]></description>
<dc:creator>burningman</dc:creator>
<category>Coding</category><pubDate>Sat, 13 Nov 2010 05:33:36 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,61983,62049#msg-62049</guid>
<title>Re: Simple Network connection</title><link>http://forum.wiibrew.org/read.php?11,61983,62049#msg-62049</link><description><![CDATA[ can we see the code?]]></description>
<dc:creator>g_man</dc:creator>
<category>Coding</category><pubDate>Sat, 13 Nov 2010 03:52:15 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,61983,62048#msg-62048</guid>
<title>Re: Simple Network connection</title><link>http://forum.wiibrew.org/read.php?11,61983,62048#msg-62048</link><description><![CDATA[ would there need to be any changes to the code to compile it, say with the c++ compiler? i have some example code for bsd sockets, but for some reason it always says it connects to the ip address i give it even if i dont have a program on the other computer to accept a connection. the code i have is for c not c++, but it compiles fine, but doesnt seem to work.]]></description>
<dc:creator>burningman</dc:creator>
<category>Coding</category><pubDate>Sat, 13 Nov 2010 03:37:53 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,61983,62040#msg-62040</guid>
<title>Re: Simple Network connection</title><link>http://forum.wiibrew.org/read.php?11,61983,62040#msg-62040</link><description><![CDATA[ Also check this old thread out. [<a href="http://forum.wiibrew.org/read.php?11,7131,7355#msg-7355" rel="nofollow">forum.wiibrew.org</a>]<br /><br />The Wii&#039;s network functions are listed in it. Weird I remembered that thread but the search could not find it.]]></description>
<dc:creator>scanff</dc:creator>
<category>Coding</category><pubDate>Fri, 12 Nov 2010 22:23:19 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,61983,62036#msg-62036</guid>
<title>Re: Simple Network connection</title><link>http://forum.wiibrew.org/read.php?11,61983,62036#msg-62036</link><description><![CDATA[ Read up on <b>bsd sockets</b>. It is the exact same thing as the wii sockets. By looking at your code, you don&#039;t know them. Once you can make a few socket examples on your pc then the only difference is all of the wii functions add net_ to the beginning of the function name.]]></description>
<dc:creator>g_man</dc:creator>
<category>Coding</category><pubDate>Fri, 12 Nov 2010 19:28:48 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,61983,62035#msg-62035</guid>
<title>Re: Simple Network connection</title><link>http://forum.wiibrew.org/read.php?11,61983,62035#msg-62035</link><description><![CDATA[ the only thing i changed in the http.c/h files was added the function declares as well as a typedef for boolean as it is used but wasnt declared in the code]]></description>
<dc:creator>burningman</dc:creator>
<category>Coding</category><pubDate>Fri, 12 Nov 2010 19:15:08 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,61983,62034#msg-62034</guid>
<title>Re: Simple Network connection</title><link>http://forum.wiibrew.org/read.php?11,61983,62034#msg-62034</link><description><![CDATA[ and here the makefile:<br /><br /><pre class="bbcode">

#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif

include $(DEVKITPPC)/wii_rules

#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
#---------------------------------------------------------------------------------
TARGET		:=	$(notdir $(CURDIR))
BUILD		:=	build
SOURCES		:=	source source/gfx
DATA		:=	data
INCLUDES	:=

#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------

CFLAGS	= -g -O2 -Wall $(MACHDEP) $(INCLUDE)
CXXFLAGS	=	$(CFLAGS)

LDFLAGS	=	-g $(MACHDEP) -Wl,-Map,$(notdir $@).map

#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
# the order can-be/is critical
#---------------------------------------------------------------------------------
LIBS	:= -lgrrlib -lfreetype -lpngu -lpng -ljpeg -lz -lfat
LIBS	+= -lwiiuse
#LIBS	+= -lmodplay -laesnd
LIBS	+= -lbte -logc -lm

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS	:=

#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------

export OUTPUT	:=	$(CURDIR)/$(TARGET)

export VPATH	:=	$(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
					$(foreach dir,$(DATA),$(CURDIR)/$(dir))

export DEPSDIR	:=	$(CURDIR)/$(BUILD)

#---------------------------------------------------------------------------------
# automatically build a list of object files for our project
#---------------------------------------------------------------------------------
CFILES		:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES	:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
sFILES		:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
SFILES		:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
BINFILES	:=	$(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))

#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
	export LD	:=	$(CC)
else
	export LD	:=	$(CXX)
endif

export OFILES	:=	$(addsuffix .o,$(BINFILES)) \
					$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
					$(sFILES:.s=.o) $(SFILES:.S=.o)

#---------------------------------------------------------------------------------
# build a list of include paths
#---------------------------------------------------------------------------------
export INCLUDE	:=	$(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
					$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
					-I$(CURDIR)/$(BUILD) \
					-I$(LIBOGC_INC)

#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS	:=	$(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
					-L$(LIBOGC_LIB)

export OUTPUT	:=	$(CURDIR)/$(TARGET)
.PHONY: $(BUILD) clean

#---------------------------------------------------------------------------------
$(BUILD):
	@[ -d $@ ] || mkdir -p $@
	@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

#---------------------------------------------------------------------------------
clean:
	@echo clean ...
	@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol

#---------------------------------------------------------------------------------
run:
	wiiload $(TARGET).dol


#---------------------------------------------------------------------------------
else

DEPENDS	:=	$(OFILES:.o=.d)

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).dol: $(OUTPUT).elf
$(OUTPUT).elf: $(OFILES)

#---------------------------------------------------------------------------------
# This rule links in binary data with the .jpg extension
#---------------------------------------------------------------------------------
%.jpg.o	:	%.jpg
#---------------------------------------------------------------------------------
	@echo $(notdir $&lt;)
	$(bin2o)

#---------------------------------------------------------------------------------
# This rule links in binary data with the .png extension
#---------------------------------------------------------------------------------
%.png.o	:	%.png
#---------------------------------------------------------------------------------
	@echo $(notdir $&lt;)
	$(bin2o)

-include $(DEPENDS)

#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
</pre>]]></description>
<dc:creator>burningman</dc:creator>
<category>Coding</category><pubDate>Fri, 12 Nov 2010 19:06:32 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,61983,62033#msg-62033</guid>
<title>Re: Simple Network connection</title><link>http://forum.wiibrew.org/read.php?11,61983,62033#msg-62033</link><description><![CDATA[ heres the code:<br /><br /><pre class="bbcode">

/*===========================================
        GRRLIB (GX Version)
        - Template Code -

        Minimum Code To Use GRRLIB
============================================*/

/*

		Basics for My Wii RPG game
*/

//#include <stdlib.h>
//#include <stdio.h>

#include <sstream>

#include <string>
#include <map>

#include <grrlib.h>

#include <ogc/lwp_watchdog.h>   // Needed for gettime and ticks_to_millisecs

#include <stdlib.h>
#include <wiiuse/wpad.h>

#include <fat.h>

// include files for gfx
#include "gfx/arial_12.h"
#include "gfx/BMfont1.h"
#include "gfx/BMfont2.h"
#include "gfx/BMfont3.h"
#include "gfx/BMfont4.h"
#include "gfx/BMfont5.h"

#include "gfx/button.h"
#include "gfx/button_over.h"
#include "gfx/dialogue_box.h"

#include "gfx/player1_point.h"

// include file for network functions
#include "net/http.h"

// RGBA Colors
#define GRRLIB_BLACK   0x000000FF
#define GRRLIB_MAROON  0x800000FF
#define GRRLIB_GREEN   0x008000FF
#define GRRLIB_OLIVE   0x808000FF
#define GRRLIB_NAVY    0x000080FF
#define GRRLIB_PURPLE  0x800080FF
#define GRRLIB_TEAL    0x008080FF
#define GRRLIB_GRAY    0x808080FF
#define GRRLIB_SILVER  0xC0C0C0FF
#define GRRLIB_RED     0xFF0000FF
#define GRRLIB_LIME    0x00FF00FF
#define GRRLIB_YELLOW  0xFFFF00FF
#define GRRLIB_BLUE    0x0000FFFF
#define GRRLIB_FUCHSIA 0xFF00FFFF
#define GRRLIB_AQUA    0x00FFFFFF
#define GRRLIB_WHITE   0xFFFFFFFF
#define GRRLIB_ALPHA   0XFFFFFF50

// Defines for Max Controls on Dialogs
#define MAX_BUTTONS		10
#define MAX_IMAGES		10
#define MAX_TEXT		10
#define MAX_CANVAS		10

// Defines for Dialog Window Types
#define NOFRAME			0
#define FRAME			1

using namespace std;

ir_t ir1;
u32 wpaddown, wpadheld;


	GRRLIB_texImg *tex_Arial = GRRLIB_LoadTexture(Arial_12);
	
	GRRLIB_texImg *tex_BMfont1 = GRRLIB_LoadTexture(BMfont1);
    

    GRRLIB_texImg *tex_BMfont2 = GRRLIB_LoadTexture(BMfont2);
   

    GRRLIB_texImg *tex_BMfont3 = GRRLIB_LoadTexture(BMfont3);


    GRRLIB_texImg *tex_BMfont4 = GRRLIB_LoadTexture(BMfont4);


    GRRLIB_texImg *tex_BMfont5 = GRRLIB_LoadTexture(BMfont5);
	
	GRRLIB_texImg *tex_button = GRRLIB_LoadTexture(button);
	GRRLIB_texImg *tex_button_over = GRRLIB_LoadTexture(button_over);
	GRRLIB_texImg *tex_dialog = GRRLIB_LoadTexture(dialogue_box);
	
	GRRLIB_texImg *tex_pointer = GRRLIB_LoadTexture(player1_point);
	
//#include "WindowClass.h"


int str2int(string str,int num)
{
	//char * cstr;
	//cstr = new char [str.size()+1];
	//strcpy (cstr, str.c_str());
	
	//return itoa(num,cstr,10);
};

string int2str(int num)
{
	/*char * cstr;
	string str;
	int t=2;
	if (num&gt;9) t=3;
	if (num&gt;99) t=4;
	//cstr = new char [t];
	//strcpy (cstr, str.c_str());
	sprintf("%4d",cstr,num);
	str=(string)cstr;*/
	
	string Result;          // string which will contain the result

	ostringstream convert;   // stream used for the conversion
	
	convert &lt;&lt; num;      // insert the textual representation of &#039;Number&#039; in the characters in the stream

	Result = convert.str();
	
	return Result;//itoa(num,cstr,10);
};


class GuiWindow {
public:

string GUIName;

map <string,void(*)()> ButtonCallBack[MAX_BUTTONS];

GuiWindow(string str,int xpos, int ypos,GRRLIB_texImg *fnt,int winType)
{
	specs.title=str;
	specs.x=xpos;
	specs.y=ypos;
	specs.w=600;
	specs.h=400;
	specs.font=fnt;
	specs.winType=winType;
	int index;
	
	for (index=0;index<MAX_BUTTONS;index++) 		buttons[index].active=false; 		 	for (index=0;index&lt;MAX_IMAGES;index++) 		images[index].active=false; 	 	for (index=0;index&lt;MAX_TEXT;index++) 		text[index].active=false; 		 	for (index=0;index&lt;MAX_CANVAS;index++) 		canvas[index].active=false; 	 	 };   ~GuiWindow() { };  int create_button(int index,string caption,int x,int y,GRRLIB_texImg *font,void (*ptr)(),string ptr_name) {  //int index;    //for(index=0;index&lt;MAX_BUTTONS;index++)  //{  if (buttons[index].active==false)  	{ 		buttons[index].active=true; 		buttons[index].caption=caption; 		buttons[index].x=x; 		buttons[index].y=y; 		buttons[index].w=caption.length()*16; 		buttons[index].h=32; 		buttons[index].font=font; 		buttons[index].img=tex_button; 		buttons[index].img_over=tex_button_over; 		ButtonCallBack[index][ptr_name.c_str()]=ptr; 		return index; 	}  //}  //return -1; };  int create_text(string caption,int x,int y,GRRLIB_texImg *font) {  int index;    for(index=0;index&lt;MAX_TEXT;index++)  {  if (text[index].active==false)  	{ 		text[index].active=true; 		text[index].caption=caption; 		text[index].x=x; 		text[index].y=y; 		text[index].w=caption.length()*16; 		text[index].h=32; 		text[index].font=font; 		return index; 	}  }  return -1; };  void change_text(int index,string caption="",int x=-1,int y=-1) { 	if (caption!="") text[index].caption=caption; 	if (x!=-1) text[index].x=x; 	if (y!=-1) text[index].y=y; };  void change_button(int index,string caption) { 	buttons[index].caption=caption; };  void create_image() { };  void create_canvas() { };  int get_width(); int get_height(); int get_xpos(); int get_ypos();  //void add_callback(void (*ptr)(),string ptr_name) //{ 	//funcMap[ptr_name.c_str()]=ptr; //}   /*	Draw Window and Window Controls */ void draw(string ptr) { 	//int index; 	//f32 degrees=0,scalex=1,scaley=1; 	 	if (specs.winType==FRAME) 	{ 		GRRLIB_Rectangle (specs.x, specs.y, specs.w, specs.h, GRRLIB_WHITE,1); 		GRRLIB_Rectangle (specs.x+1, specs.y+1, specs.w-2, specs.h-6, GRRLIB_GRAY,1); 		GRRLIB_Rectangle (specs.x+2, specs.y+2, specs.w-4, 4+specs.font->h, GRRLIB_WHITE, 1);
		GRRLIB_Printf(specs.x+6, specs.y+6, specs.font, GRRLIB_BLACK, 1, "%s",specs.title.c_str());
	}
	//funcMap[ptr.c_str()]();
	
	//calls the fucntion to draw the button controls on the window
	draw_buttons();
	
	draw_text();
	
	//GRRLIB_Rectangle (x+2, y+2, w-2, h-2, GRRLIB_AQUA,0);
};

/*	Process window control callbacks (selected or clicked on controls)
*/
void do_window()
{
};

private:

/*
	Draws the buttons on the Window
*/

void draw_buttons()
{
	int index;
	float scalex=0.5,scaley=0.7,degrees=0;
	
	for(index=0;index&lt;MAX_BUTTONS;index++)
	{
		if (buttons[index].active)
			{
				//GRRLIB_Rectangle (buttons[index].x, buttons[index].y, buttons[index].w, buttons[index].h, GRRLIB_WHITE,1);
				GRRLIB_DrawImg (buttons[index].x, buttons[index].y,tex_button, degrees, scalex, scaley, RGBA(255,255,255,255));
				GRRLIB_Printf (buttons[index].x+4+((buttons[index].caption.length()*8)/2), buttons[index].y+8, buttons[index].font, GRRLIB_BLACK, 1, "%s",buttons[index].caption.c_str());
			}
	}
};

void draw_text()
{
int index;

	for (index=0;index&lt;MAX_TEXT;index++)
	{
		if (text[index].active)
			GRRLIB_Printf (text[index].x, text[index].y, text[index].font, GRRLIB_BLACK, 1, "%s",text[index].caption.c_str());
	}
};

void draw_images()
{
};

void draw_canvas()
{
};

/* Window Specifications

Width, Height, X Position, Y Position, Title, Font, Window Type (frame/no frame)
*/
struct specs_t
{
 string title;
 int x,y,w,h,winType;
 GRRLIB_texImg *font;
 
} specs;

int total_buttons;
int total_images;
int total_canvas;

struct buttons_t
{
	bool active,focus;
	string caption;
	int x,y,w,h;
	GRRLIB_texImg *font;
	GRRLIB_texImg *img;
	GRRLIB_texImg *img_over;
	GRRLIB_texImg *img_click;
} buttons[MAX_BUTTONS];

struct text_t
{
	bool active,focus;
	int x,y,w,h;
	string caption;
	GRRLIB_texImg *font;
	u32 color;
} text[MAX_TEXT];

struct images_t
{
	bool active,focus;
	int x,y,w,h;
	GRRLIB_texImg *img;
} images[MAX_IMAGES];

struct canvas_t
{
	bool active,focus;
	int x,y,w,h;
	GRRLIB_texImg *img;
} canvas[MAX_CANVAS];


};



void pointer()
{
	GRRLIB_Printf(5, 125, tex_BMfont5, GRRLIB_BLACK, 1, "GRRLIB %s Template Modified by %s", GRRLIB_VER_STRING,"BurningMan");
}




int main(int argc, char **argv) {
int but,txt,xtxt,ytxt,version;

string tmp;

bool done=false;

//tcp_init();

//funcMap["point"]=pointer
;
//GuiButton but("exit");
GuiWindow win("Main Window",5,20,tex_BMfont5,FRAME);
//win.add_callback(pointer,"p");

but=win.create_button(0,"button1",20,150,tex_BMfont5,pointer,"p");

txt=win.create_text("text",150,190,tex_BMfont5);

xtxt=win.create_text("000",50,220,tex_BMfont5);
ytxt=win.create_text("000",50,240,tex_BMfont5);

//version=win.create_text((string)ver,50,300,tex_BMfont5);



    // Initialise the Graphics & Video subsystem
    GRRLIB_Init();
	
	
	
	GRRLIB_InitTileSet(tex_BMfont1, 32, 32, 32);
	GRRLIB_InitTileSet(tex_BMfont2, 16, 16, 32);
    GRRLIB_InitTileSet(tex_BMfont3, 32, 32, 32);
	GRRLIB_InitTileSet(tex_BMfont4, 16, 16, 32);
    GRRLIB_InitTileSet(tex_BMfont5, 8, 16, 0);
	GRRLIB_InitTileSet(tex_Arial, 8, 16, 0);
	 
    // Initialise the Wiimotes
    WPAD_Init();
	WPAD_SetDataFormat(WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR);
	WPAD_SetVRes(WPAD_CHAN_ALL, 640, 480);
	
	s32 tcp=tcp_connect("192.168.1.102",2002);
	
    // Loop forever
    while(!done) {

        WPAD_ScanPads();
        wpaddown = WPAD_ButtonsDown(0);
        wpadheld = WPAD_ButtonsHeld(0);

        WPAD_IR(WPAD_CHAN_0, &ir1);
		
		GRRLIB_FillScreen(GRRLIB_BLACK);    // Clear the screen
		
		win.draw("p");
		
		if (ir1.valid)
		{
			//GRRLIB_Circle(ir1.x, ir1.y, 10, GRRLIB_OLIVE, 1);
			// Draw a yellow four pixel dot where the wiimote is pointing
			//GRRLIB_Plot(ir1.x, ir1.y, GRRLIB_YELLOW);
			//GRRLIB_Plot(ir1.x + 1, ir1.y, GRRLIB_YELLOW);
			//GRRLIB_Plot(ir1.x, ir1.y + 1, GRRLIB_YELLOW);
			//GRRLIB_Plot(ir1.x + 1, ir1.y + 1, GRRLIB_YELLOW);
			
			GRRLIB_DrawImg (ir1.x-62, ir1.y-9,tex_pointer, 0, 1, 1, RGBA(255,255,255,128));		
		}
		
		tmp=int2str(ir1.x-62);
		win.change_text(xtxt,tmp);
		tmp=int2str(ir1.y-9);
		win.change_text(ytxt,tmp);
		//funcMap["point"]();
		

        // If [HOME] was pressed on the first Wiimote, break out of the loop
        if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) done=true;
		if (WPAD_ButtonsDown(0) & WPAD_BUTTON_UP) win.change_text(txt,"Up",150,32);
		if (WPAD_ButtonsDown(0) & WPAD_BUTTON_DOWN) win.change_text(txt,"Down",150,300);
		if (WPAD_ButtonsDown(0) & WPAD_BUTTON_LEFT) win.change_text(txt,"Left",0,150);
		if (WPAD_ButtonsDown(0) & WPAD_BUTTON_RIGHT) win.change_text(txt,"Right",300,150);
		//if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) win.change_text(txt,"Home",150,150);

        // ---------------------------------------------------------------------
        // Place your drawing code here
        // ---------------------------------------------------------------------

        GRRLIB_Render();  // Render the frame buffer to the TV
    }

    GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB
	    // Free some textures
   
    GRRLIB_FreeTexture(tex_BMfont1);
    GRRLIB_FreeTexture(tex_BMfont2);
    GRRLIB_FreeTexture(tex_BMfont3);
    GRRLIB_FreeTexture(tex_BMfont4);
    GRRLIB_FreeTexture(tex_BMfont5);
	GRRLIB_FreeTexture(tex_Arial);
	
	GRRLIB_FreeTexture(tex_button);
	GRRLIB_FreeTexture(tex_button_over);
	GRRLIB_FreeTexture(tex_dialog);
	
	GRRLIB_FreeTexture(tex_pointer);
   
    exit(0);  // Use exit() to exit a program, do not use &#039;return&#039; from main()
}
</pre>]]></description>
<dc:creator>burningman</dc:creator>
<category>Coding</category><pubDate>Fri, 12 Nov 2010 19:05:34 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,61983,62031#msg-62031</guid>
<title>Re: Simple Network connection</title><link>http://forum.wiibrew.org/read.php?11,61983,62031#msg-62031</link><description><![CDATA[ can we see that code, and also show the makefile.]]></description>
<dc:creator>g_man</dc:creator>
<category>Coding</category><pubDate>Fri, 12 Nov 2010 18:23:23 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,61983,62027#msg-62027</guid>
<title>Re: Simple Network connection</title><link>http://forum.wiibrew.org/read.php?11,61983,62027#msg-62027</link><description><![CDATA[ i understand that, but the problem that i have with using that code right now, is that it givews me the following error:<br /><br /><i>linking ... template.elf<br />main.o: In function `main&#039;:<br />main.cpp:(.text.main+0x450): undefined reference to `tcp_connect(char*, unsigned short)&#039;<br />collect2: ld returned 1 exit status<br />make[1]: *** [/d/template/template.elf] Error 1<br />"make": *** [build] Error 2</i><br /><br />the only function im using right now is the tcp_connect, just to test to see if it would work.]]></description>
<dc:creator>burningman</dc:creator>
<category>Coding</category><pubDate>Fri, 12 Nov 2010 17:21:12 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,61983,61988#msg-61988</guid>
<title>Re: Simple Network connection</title><link>http://forum.wiibrew.org/read.php?11,61983,61988#msg-61988</link><description><![CDATA[ it works almost exactly the same as bsd sockets. Look up those and then try writing your code.]]></description>
<dc:creator>g_man</dc:creator>
<category>Coding</category><pubDate>Thu, 11 Nov 2010 21:05:58 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,61983,61986#msg-61986</guid>
<title>Re: Simple Network connection</title><link>http://forum.wiibrew.org/read.php?11,61983,61986#msg-61986</link><description><![CDATA[ I havent written any code myself. ive had some experience using similar class functions like send and recv in realbasic (OOP style coding similar to C/C++ with classes and such). but none of the wii netcode i have found (not very much) has not been in any form usable (at least by me). i had tried including the WiiNetwork code (link for it on WiiBrew Dev Tools List), but it doesnt want to compile, says things are undefined when they are in the include file and such. theres no sample with that so its hard to see what exactly i need to do to get it up and running. unless ive missed something, which i may have, im stumped. if you or anyone could even help with using that code, it would be MUCH appreciated.]]></description>
<dc:creator>burningman</dc:creator>
<category>Coding</category><pubDate>Thu, 11 Nov 2010 19:14:13 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,61983,61985#msg-61985</guid>
<title>Re: Simple Network connection</title><link>http://forum.wiibrew.org/read.php?11,61983,61985#msg-61985</link><description><![CDATA[ Have you written any of the code yet? If so can we see it? It will be more benifitial to you if you edit your existing code, than sombeody gives you working code.]]></description>
<dc:creator>g_man</dc:creator>
<category>Coding</category><pubDate>Thu, 11 Nov 2010 19:05:37 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,61983,61983#msg-61983</guid>
<title>Simple Network connection</title><link>http://forum.wiibrew.org/read.php?11,61983,61983#msg-61983</link><description><![CDATA[ Hi, i was wondering if someone could help me with this. only thing i really need, is a simple class to initilize a connect TO a server. i took a look at the sockettest example, and its very confusing to read as theres not many comments or explainations for whats bieng done. the example works, but the wii app waits for a connection FROM another device, but i want to connect TO another device. i more or less understand how to use the net_send/net_recv functions, but its the setting up of the connect im having trouble.<br /><br />- BurningMan]]></description>
<dc:creator>burningman</dc:creator>
<category>Coding</category><pubDate>Thu, 11 Nov 2010 18:43:13 +0100</pubDate></item>
</channel>
</rss>