Raised This Month: $ Target: $400
 0% 

will be [32] enought for an IP address?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Owyn
Veteran Member
Join Date: Nov 2007
Old 02-12-2009 , 16:12   will be [32] enought for an IP address?
Reply With Quote #1

just wondering will
user_ip[32]
work fine or not
Owyn is offline
Send a message via ICQ to Owyn
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 02-12-2009 , 16:15   Re: will be [32] enought for an IP address?
Reply With Quote #2

With port: 22
Without port: 16

Anything more than that is wasted space
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).

Last edited by YamiKaitou; 02-13-2009 at 08:43.
YamiKaitou is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 02-12-2009 , 16:19   Re: will be [32] enought for an IP address?
Reply With Quote #3

thx ^^ i thought so
Owyn is offline
Send a message via ICQ to Owyn
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 02-13-2009 , 04:28   Re: will be [32] enought for an IP address?
Reply With Quote #4

Quote:
Originally Posted by YamiKaitou View Post
Without port: 15
You mean 16.

xxx.xxx.xxx.xxx + 1
Spunky is offline
Send a message via AIM to Spunky
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-13-2009 , 07:17   Re: will be [32] enought for an IP address?
Reply With Quote #5

Code:
// 123456789012345
// xxx.xxx.xxx.xxx

// length of an IP without a port is 15

// when creating a variable for a string,
// the size should be the length + 1
// this is because the array must have 0 as it's final cell to be a string

new ip[16];
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 02-13-2009 , 08:40   Re: will be [32] enought for an IP address?
Reply With Quote #6

An IP without the port is 14 chars, so new ip[15] works.

Code:
111.111.111.111:65535
123456789012345678901

EDIT: At least everytime I do it I come up with 14 chars...


EDIT2: What do you know, they didn't line up. Original post changed as the w/port one is wrong as well.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).

Last edited by YamiKaitou; 02-13-2009 at 08:43.
YamiKaitou is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-13-2009 , 08:48   Re: will be [32] enought for an IP address?
Reply With Quote #7

111.111.111.111 ; 111 = 3 chars ; . = 1 char ; 4*3 + 3 = 15 chars

So it should be Ip[16];

Last edited by Arkshine; 02-13-2009 at 08:50.
Arkshine is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 02-13-2009 , 10:02   Re: will be [32] enought for an IP address?
Reply With Quote #8

I could always say that I was saying the value of charsmax for them. But, that wasn't what I intended to say, so I miscounted
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 02-13-2009 , 10:22   Re: will be [32] enought for an IP address?
Reply With Quote #9

Assuming AMXX can handle IPV6, 16 won't be enough.
__________________
Brad is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-13-2009 , 10:47   Re: will be [32] enought for an IP address?
Reply With Quote #10

In this case : "xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx" , it would be : 8*4 + 7 = 39 chars

So, Ip[40], if I'm right.
Arkshine is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:55.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode