The online racing simulator
Quote : ? You are asking for help and I tell you that I will hand you a solution. You then tell me to get out of your thread? illepall

Excuse me. I know what GPL means, all my scripts are also published using this license, but this sounded more like a release announcement to me than like "Hey I'll post something that will help you". Please notice I am not a native english speaker and may not understand the language as well as you do.

This may come in late, but thanks for this announcement
Quote from St4Lk3R :what pack-type should I use when I want to pack/unpack an int value?.. ..(I assume the server ignores bad-encoded packages, because I do not get any answer on my listening socket).

Use i to pack/unpack an int, the server does not ignore bad packets if you don't tell it to ignore packet warnings: ..
#define ISF_NO_WARNINGS 8 // bit 3 : turns off packet warnings

.. but it only displays the warning in the server console, it doesn't send anything.
thanks filur and Leachman.
hi.

I tried to follow the instructions posted before to connect php to insim, but when I run the script nothing happens...

Can someone give me some hints on how to connect to insim?

I tried with the script posted before, replaced with my ip and my adminpwd but with no luck.

Thanks a lot
Hi Goodfella.

If you connect to InSim and only send an InSimInit-Package, nothing happens. This is how it should be.


But once again, I have a problem to solve with my InSim-Class. I do not receive any answer, even if I encode the InSimPack correctly... meaning if I do a VER-request, no package comes back to the listening socket.

Maybe you can help once again, filur?

E: The source of my class can be found here:
http://www.stalkernet.info/sou ... classes/scmslfs.class.php

Thanks in advance!
Haven't read or tried the class yet, but iirc you should get some kind of console output from LFS even if you're not sending the right stuff.
Packet received before ISI packet, Admin password doesnt match, unknown packet (x bytes).

And a successfull InSimInit should of course render ..
InSimInit: port x

Hi filur,

The InSimInit package is sent correctly, on my local testserver it outputs "InSimInit: Port 30001". That means the problem is located at that socket thing. Well... you said you moved to php5 very early when you started writing that InSim stuff... Were you able to receive messages from insim? Do you maybe have some old scripts from that time? I really need help...
Quote from St4Lk3R :Were you able to receive messages from insim?

I was able to send and receive, but i could not in any way manage to get the socket functions in php4 and the socket dll/so to work non-blocking, meaning any read or write operation would halt the entire script until it was finished.

You really should move to php5, php6 is already on it's way, but i'll try writing something short for php4, hang on.
thank you so much for this extra work...
Well, i failed, and google failed. Maybe i switched to the stream_ function set even earlier. To me, it seems the socket extension for php4 simply isn't finished, and with things being so incredibly simple in php5, it's absolutely not worth the hassle.

So, switch to php5 or install a separate cli-only php5 to use for this, because while there might be a magic trick to get it somewhat working under php4, comparing the amount of work involved under php4 to the amount of work under php5, using php4 seems like a really bad idea. Even if you're trying to run it under a webserver where you for some reason really don't want to switch php versions--and wan't short bursts of data off insim, running an exec or system call to a php5-cli would be less work, and you'd have the output in php4 thru stdout.

I do know for sure that i've been playing with sockets in php4, probably TCP, and had those non-blocking errors, another problem completely solved by php5.
ok... *sigh*

lets start switching. thanks again for trying it
but are there in the web any live example of php communicating with insim?

thanks
as far as I know there are no live examples. if you want to create a php-script for insim, try filurs example (the link was posted on page 1).
I saw it, but it's very hard debugging that script with a lfs server... i don't know if it works or not...
Quote from Goodfella :I saw it, but it's very hard debugging that script with a lfs server... i don't know if it works or not...

Well, it doesn't really need debugging since it doesn't do anything except actually showing you that it does work. (ft. keanu)

I've got quite a neat PHP package coming along, but in the meantime you'll have to figure it out yourself.
when you're talking about that filur: when will it come along?
sorry Filur,
with your script, also remote servers are accessible?

because I tried with a remote server and i get

Warning: stream_socket_server() [function.stream-socket-server]: unable to connect to udp://87.117.226.71:30000 (Indirizzo richiesto non valido nel proprio contesto. ) in c:\Inetpub\wwwroot\prova.php on line 3
Quote from St4Lk3R :when you're talking about that filur: when will it come along?



It's been in sporadic development for almost a year, starting to actually be really stable and truly useful lately. I'm still finding 'core' errors and annoyances from time to time, which is why i've not released anything so far. You can join FLP's server FLP Racing for a taster, the FLP Soccer 'mod' also runs on my insim code. The core insim class can of course be used for pretty much anything, not just running as an 'insim application'.

Hey, this is the most info i've ever given out so far, be happy, dygear!

(should be able to release something pretty soon, really.)

Quote from Goodfella :with your script, also remote servers are accessible?

Should be, you'll probably need to change the server_bind on the incoming socket to your external ip, or just use 0.0.0.0 (all devices), if your external ip is held by a router, use 0.0.0.0.
wrong way.

you're connecting to the insim-port of lfs when you use fsockopen. stream_socket_server is for opening a LOCAL server listening to the responses of lfs. so udp://localhost:30000 is the correct url in all cases.

E: filur, you make me happy. Do you need beta-testers?
Quote from St4Lk3R :wrong way.

you're connecting to the insim-port of lfs when you use fsockopen. stream_socket_server is for opening a LOCAL server listening to the responses of lfs. so udp://localhost:30000 is the correct url in all cases.

A remote server can't connect to your localhost, thus you bind the socket on all devices.

Quote from St4Lk3R :Do you need beta-testers?

I guess i do, i'll send a PM some day when i've not got a load of league races to prepare for, websites to code, cold coffee, etc.
you misunderstood him IMO. he entered his lfs-server's IP-address into the stream_socket_server function, which is of course wrong, because this is the local server you open to listen to the responses of lfs. so localhost is the IP to enter here. at the fsockopen-site it it the IP of your lfs-server.

E: happy²
Quote from St4Lk3R :you misunderstood him IMO. he entered his lfs-server's IP-address into the stream_socket_server function, which is of course wrong, because this is the local server you open to listen to the responses of lfs. so localhost is the IP to enter here.

Confusing. Well, anyway, localhost isn't necessarily the right one because a remote server still cannot connect to a socket locally bound to 127.0.0.1
you did it in your script sample... illepall now I am confused.
Quote from St4Lk3R :you did it in your script sample... illepall now I am confused.

Yeah i guess i assumed you'd run both the script and the server locally.
so what I have to do for example if I have a remote server?

change only the first IP?

if I leave 127.0.0.1:30000 in the second IP, the script run without warnings but it doesn't return anything...

thanks

FGED GREDG RDFGDR GSFDG