Problem found with RegexOptions and Webplayer on Unity 3

69 views
Skip to first unread message

Llorenç Marti

unread,
Oct 19, 2010, 4:41:23 AM10/19/10
to lidgren-network
Hi Michael

I want to inform that for new security reasons, i think Lidgren
library is not working with new Unity 3 (remember that i am not 100%
sure that i am correct).
(Lidgren gen 2 used)

I found that:

- When i execute the game in windows/PC mode, all OK.

- When i execute the game via WebPlayer, then, a problem arise at
connection

ArgumentOutOfRangeException: Argument is out of range.

Parameter name: options
at System.Text.RegularExpressions.Regex.validate_options
(RegexOptions options) [0x00000] in <filename unknown>:0
at System.Text.RegularExpressions.Regex..ctor (System.String
pattern, RegexOptions options) [0x00000] in <filename unknown>:0
at Lidgren.Network.NetUtility.Resolve (System.String ipOrHost)
[0x00000] in <filename unknown>:0
at Lidgren.Network.NetClient.Connect (System.String host, Int32
port, System.Byte[] hailData) [0x00000] in <filename unknown>:0
at NetHandler.Start () [0x00000] in <filename unknown>:0


I pass "192.168.1.10" and 38381 to tha 'Connect' function, so, when
the Lidgren Lib tries to resolve the IP (string ----> byte[ ]) then
it crashes.

//
-------------------------------------------------------------------------------
public static IPAddress Resolve(string ipOrHost)
{
if (string.IsNullOrEmpty(ipOrHost))
throw new ArgumentException("Supplied string must not be empty",
"ipOrHost");

ipOrHost = ipOrHost.Trim();

if (s_regIP == null)
{
string expression = "\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\
\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b";
RegexOptions options = RegexOptions.Compiled;
s_regIP = new Regex(expression, options);
<-------------------------------------------- ( I think its here
the problem )
}

....

//
-------------------------------------------------------------------------------

I can bypass this error using the other Connect function that takes a
byte array and doesnt need any Resolve instruction.

Thanks for your time and work :)

LLORENS

r4ccoon

unread,
Oct 19, 2010, 7:10:08 AM10/19/10
to lidgren-network
hmm. glad i haven't upgraded my game to unity3. but have to do it
sooner or later.

lidgren

unread,
Oct 19, 2010, 12:48:22 PM10/19/10
to lidgren-network
The regex check isn't really necessary - i've checked in revision 292
where it's removed.

--michael
Reply all
Reply to author
Forward
0 new messages