|
Das deutsche QBasic- und FreeBASIC-Forum Für euch erreichbar unter qb-forum.de, fb-forum.de und freebasic-forum.de!
|
Vorheriges Thema anzeigen :: Nächstes Thema anzeigen |
Autor |
Nachricht |
Mathias Kwiatkowski
Anmeldungsdatum: 17.05.2005 Beiträge: 11 Wohnort: dinslaken
|
Verfasst am: 18.07.2005, 19:55 Titel: Internet? geht sowas? |
|
|
hi leute wie kann ich das internet in freebasic benutzen?
also was ich genau meine ist:
ich möchte einfach ein´kleines prog schreiben wo man narichten an jemanden schreiben kann
sagen wir ich schreibe ein server&client version die nur 2 leute benutzen können (also ich und du) ich schreibe ein text (string) und möchte nun das du diesen string in dem fenster siehst den ich geschrieben habe!!!
wie geht sowas?
ich hoffe ich habe mich so klar ausgedrückt das du ihr es versteht danke im vorraus für jede hilfe |
|
Nach oben |
|
|
Sebastian Administrator
Anmeldungsdatum: 10.09.2004 Beiträge: 5969 Wohnort: Deutschland
|
|
Nach oben |
|
|
Progger_X Mr. Lagg
Anmeldungsdatum: 24.11.2004 Beiträge: 784 Wohnort: Leipzig
|
Verfasst am: 18.07.2005, 22:22 Titel: |
|
|
Zieh dir mal den Beispielcode von Dumbledore (ich glaub, er wars) vom internationalen Freebasic Forum. Damit kannst du aufs Heimnetzwerk zugreifen.
Für das Internet musst du dann halt einfach die andere IP einsetzen, ist ja sozusagen nen Heimnetzwerk.
Wenn du den Forenbeitrag net findest, schreibs hier rein, dann such ich dir den raus, irgendwo hab ich den auch noch auf meinem Computer. |
|
Nach oben |
|
|
Mathias Kwiatkowski
Anmeldungsdatum: 17.05.2005 Beiträge: 11 Wohnort: dinslaken
|
Verfasst am: 19.07.2005, 16:55 Titel: |
|
|
so danke progger_x also volgendes
1. ich finde es nicht
2. bei mir läuft glaube ig free basic nochnimmals richtig!
also vollbild z.b. geht nicht apzulut NICHT leider
aber bitte gib mir mal das was du da hast
dank |
|
Nach oben |
|
|
Sebastian Administrator
Anmeldungsdatum: 10.09.2004 Beiträge: 5969 Wohnort: Deutschland
|
|
Nach oben |
|
|
Progger_X Mr. Lagg
Anmeldungsdatum: 24.11.2004 Beiträge: 784 Wohnort: Leipzig
|
Verfasst am: 19.07.2005, 18:25 Titel: |
|
|
Ähm..wenn FB bei dir net funzt kannste Inet vergessen.
Hast du install.bat oder so ausgeführt?
So, die Codes:
Code: |
option escape
option explicit
'$include: "SDL/SDL_net.bi"
type clientdata
x as ushort
y as ushort
sock as tcpsocket
end type
redim preserve clients(0) as clientdata
const NEWLINE = "\r\n"
#ifdef NULL
#undef NULL
#endif
const NULL = 0
if SDLNet_Init() <> 0 then end 1
dim as ipaddress ip
SDLNet_Write32( INADDR_ANY, @ip.host )
SDLNet_Write16( 5678, @ip.port )
dim as tcpsocket sock', clientconn
'SDLNet_ResolveHost( @ip, "m0n573r.afraid.org", 80 )
'dim as long ipaddr
'ipaddr = SDLNet_Read32( @ip.host )
'? ( ipaddr and &hFF000000 ) \ &h1000000; " .";
'? ( ipaddr and &hFF0000 ) \ &h10000; " .";
'? ( ipaddr and &hFF00 ) \ &h100; " .";
'? ipaddr and &hFF
sock = SDLNet_TCP_Open( @ip )
if sock = NULL then end 2
'while clients( 0 ) = NULL
'
' clients( 0 ) = SDLNet_TCP_Accept( sock )
'
'wend
'
'? "got a connection!"
'
'dim as ubyte recv
'SDLNet_TCP_Recv( clients( 0 ), @recv, 1 )
'
'if( recv = 215 ) then ? "validated!" else end 3
'
'dim as string nam
dim as integer i, j
'while recv <> 0
' SDLNet_TCP_Recv( clientconn, @recv, 1 )
' nam += chr$( recv )
'wend
'
'? nam
'
'cls
'locate 13, 40: ? "@"
dim as ushort y = 14, x = 40, ox = 1, oy = 1
dim as string a
do
clients( ubound( clients ) ).sock = SDLNet_TCP_Accept( sock )
if clients( ubound( clients ) ).sock <> NULL then
redim preserve clients( ubound( clients ) + 1 ) as clientdata
end if
a = inkey$
if right$( a, 1 ) = "H" then y -= 1 '' up
if right$( a, 1 ) = "P" then y += 1 '' down
if right$( a, 1 ) = "K" then x -= 1 '' left
if right$( a, 1 ) = "M" then x += 1 '' left
i = 0
while i <= ubound( clients ) - 1
if SDLNet_TCP_Recv( clients( i ).sock, @clients( i ).x, 2 ) = -1 then
for j = i to ubound( clients ) - 1
clients( j ).sock = clients( j + 1 ).sock
clients( j ).x = clients( j + 1 ).x
clients( j ).y = clients( j + 1 ).y
next
redim preserve clients( ubound( clients ) - 1 ) as clientdata
i -= 1
else
SDLNet_TCP_Recv( clients( i ).sock, @clients( i ).y, 2 )
dim as ushort numclients
numclients = ubound( clients ) - 1
SDLNet_TCP_Send( clients( i ).sock, @numclients, 2 )
for j = 0 to numclients
if j <> i then
SDLNet_TCP_Send( clients( i ).sock, @clients( j ).x, 2 )
SDLNet_TCP_Send( clients( i ).sock, @clients( j ).y, 2 )
else
SDLNet_TCP_Send( clients( i ).sock, @x, 2 )
SDLNet_TCP_Send( clients( i ).sock, @y, 2 )
end if
next
end if
i += 1
wend
color 7, 0
cls
for i = 0 to ubound( clients ) - 1
color i - ( i > 2 ), 3
locate clients( i ).y, clients( i ).x
? "@"
next
color 15, 0
locate y, x
? "@"
sleep 10
loop until a = chr$( 27 )
SDLNet_Quit()
sleep
|
(Server)
Code: | option escape
option explicit
'$include: "SDL/SDL_net.bi"
type clientdata
x as ushort
y as ushort
sock as tcpsocket
end type
redim preserve clients(0) as clientdata
const NEWLINE = "\r\n"
#ifdef NULL
#undef NULL
#endif
const NULL = 0
if SDLNet_Init() <> 0 then end 1
dim as ipaddress ip
SDLNet_Write32( INADDR_ANY, @ip.host )
SDLNet_Write16( 5678, @ip.port )
dim as tcpsocket sock', clientconn
'SDLNet_ResolveHost( @ip, "m0n573r.afraid.org", 80 )
'dim as long ipaddr
'ipaddr = SDLNet_Read32( @ip.host )
'? ( ipaddr and &hFF000000 ) \ &h1000000; " .";
'? ( ipaddr and &hFF0000 ) \ &h10000; " .";
'? ( ipaddr and &hFF00 ) \ &h100; " .";
'? ipaddr and &hFF
sock = SDLNet_TCP_Open( @ip )
if sock = NULL then end 2
'while clients( 0 ) = NULL
'
' clients( 0 ) = SDLNet_TCP_Accept( sock )
'
'wend
'
'? "got a connection!"
'
'dim as ubyte recv
'SDLNet_TCP_Recv( clients( 0 ), @recv, 1 )
'
'if( recv = 215 ) then ? "validated!" else end 3
'
'dim as string nam
dim as integer i, j
'while recv <> 0
' SDLNet_TCP_Recv( clientconn, @recv, 1 )
' nam += chr$( recv )
'wend
'
'? nam
'
'cls
'locate 13, 40: ? "@"
dim as ushort y = 14, x = 40, ox = 1, oy = 1
dim as string a
do
clients( ubound( clients ) ).sock = SDLNet_TCP_Accept( sock )
if clients( ubound( clients ) ).sock <> NULL then
redim preserve clients( ubound( clients ) + 1 ) as clientdata
end if
a = inkey$
if right$( a, 1 ) = "H" then y -= 1 '' up
if right$( a, 1 ) = "P" then y += 1 '' down
if right$( a, 1 ) = "K" then x -= 1 '' left
if right$( a, 1 ) = "M" then x += 1 '' left
i = 0
while i <= ubound( clients ) - 1
if SDLNet_TCP_Recv( clients( i ).sock, @clients( i ).x, 2 ) = -1 then
for j = i to ubound( clients ) - 1
clients( j ).sock = clients( j + 1 ).sock
clients( j ).x = clients( j + 1 ).x
clients( j ).y = clients( j + 1 ).y
next
redim preserve clients( ubound( clients ) - 1 ) as clientdata
i -= 1
else
SDLNet_TCP_Recv( clients( i ).sock, @clients( i ).y, 2 )
dim as ushort numclients
numclients = ubound( clients ) - 1
SDLNet_TCP_Send( clients( i ).sock, @numclients, 2 )
for j = 0 to numclients
if j <> i then
SDLNet_TCP_Send( clients( i ).sock, @clients( j ).x, 2 )
SDLNet_TCP_Send( clients( i ).sock, @clients( j ).y, 2 )
else
SDLNet_TCP_Send( clients( i ).sock, @x, 2 )
SDLNet_TCP_Send( clients( i ).sock, @y, 2 )
end if
next
end if
i += 1
wend
color 7, 0
cls
for i = 0 to ubound( clients ) - 1
color i - ( i > 2 ), 3
locate clients( i ).y, clients( i ).x
? "@"
next
color 15, 0
locate y, x
? "@"
sleep 10
loop until a = chr$( 27 )
SDLNet_Quit()
sleep
|
Client
Dafür brauchst du noch das includete Zeug, dafür suchste einfach ma in Google nach SDL_NET, und machst dann die DLL´s in den Ordner wo dus aussführst.
Aber wenn FB bei dir net klappt kannstes vergessen. |
|
Nach oben |
|
|
psygate
Anmeldungsdatum: 05.04.2005 Beiträge: 304 Wohnort: Wien und der Computer
|
Verfasst am: 21.07.2005, 23:05 Titel: |
|
|
Das mit internet sollte kein problem sein, aber ich denke, es gibt doch große beschränkungen. z.B: Websites die verschlüsselte Verbindungen verlangen, die sollten dann nciht mehr so einfach sein. |
|
Nach oben |
|
|
|
|
Du kannst keine Beiträge in dieses Forum schreiben. Du kannst auf Beiträge in diesem Forum nicht antworten. Du kannst deine Beiträge in diesem Forum nicht bearbeiten. Du kannst deine Beiträge in diesem Forum nicht löschen. Du kannst an Umfragen in diesem Forum nicht mitmachen.
|
|