|
Simple Network connection November 11, 2010 06:43PM | Registered: 15 years ago Posts: 11 |
|
Re: Simple Network connection November 11, 2010 07:05PM | Registered: 17 years ago Posts: 444 |
|
Re: Simple Network connection November 11, 2010 07:14PM | Registered: 15 years ago Posts: 11 |
|
Re: Simple Network connection November 11, 2010 09:05PM | Registered: 17 years ago Posts: 444 |
|
Re: Simple Network connection November 12, 2010 05:21PM | Registered: 15 years ago Posts: 11 |
|
Re: Simple Network connection November 12, 2010 06:23PM | Registered: 17 years ago Posts: 444 |
|
Re: Simple Network connection November 12, 2010 07:05PM | Registered: 15 years ago Posts: 11 |
/*===========================================
GRRLIB (GX Version)
- Template Code -
Minimum Code To Use GRRLIB
============================================*/
/*
Basics for My Wii RPG game
*/
//#include
//#include
#include
#include
#include |
Re: Simple Network connection November 12, 2010 07:06PM | Registered: 15 years ago Posts: 11 |
#--------------------------------------------------------------------------------- # Clear the implicit built in rules #--------------------------------------------------------------------------------- .SUFFIXES: #--------------------------------------------------------------------------------- ifeq ($(strip $(DEVKITPPC)),) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=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 $<) $(bin2o) #--------------------------------------------------------------------------------- # This rule links in binary data with the .png extension #--------------------------------------------------------------------------------- %.png.o : %.png #--------------------------------------------------------------------------------- @echo $(notdir $<) $(bin2o) -include $(DEPENDS) #--------------------------------------------------------------------------------- endif #---------------------------------------------------------------------------------
|
Re: Simple Network connection November 12, 2010 07:15PM | Registered: 15 years ago Posts: 11 |
|
Re: Simple Network connection November 12, 2010 07:28PM | Registered: 17 years ago Posts: 444 |
|
Re: Simple Network connection November 12, 2010 10:23PM | Moderator Registered: 17 years ago Posts: 703 |
|
Re: Simple Network connection November 13, 2010 03:37AM | Registered: 15 years ago Posts: 11 |
|
Re: Simple Network connection November 13, 2010 03:52AM | Registered: 17 years ago Posts: 444 |
|
Re: Simple Network connection November 13, 2010 05:33AM | Registered: 15 years ago Posts: 11 |
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;
}
|
Re: Simple Network connection November 13, 2010 07:07AM | Registered: 17 years ago Posts: 444 |
|
Re: Simple Network connection November 13, 2010 08:57PM | Moderator Registered: 17 years ago Posts: 703 |
|
Re: Simple Network connection November 14, 2010 02:21PM | Registered: 15 years ago Posts: 11 |
|
Re: Simple Network connection November 14, 2010 08:01PM | Moderator Registered: 17 years ago Posts: 703 |
|
Re: Simple Network connection November 14, 2010 09:01PM | Registered: 15 years ago Posts: 11 |
|
Re: Simple Network connection December 08, 2010 05:49AM | Registered: 15 years ago Posts: 11 |