myDC.ru

Здравствуйте, гость ( Вход | Регистрация )

 
4 страниц V  < 1 2 3 4 >  
Тема закрытаНачать новую тему

> Скачивание Странички Из Интернета И Вывод Информации В Чате, Api1 желательно

Теги
Нет тегов для показа
PomanoB
сообщение 28.2.2009, 10:56
Сообщение #21


AmxModx Scripter
*****

Группа: Пользователи
Сообщений: 302
Регистрация: 2.12.2008
Из: Королев
Пользователь №: 1 283
Спасибо сказали: 127 раз




Пока писал ты уже сам нашёл)
На GoldSrc движке всё значительно проще ...
Go to the top of the page
+Quote Post
IIPu3PAK
сообщение 11.3.2009, 11:02
Сообщение #22


Активный участник
***

Группа: Пользователи
Сообщений: 80
Регистрация: 25.2.2009
Пользователь №: 2 359
Спасибо сказали: 6 раз




а можно-ли в луа послать Удп запрос и как это сделать?
Go to the top of the page
+Quote Post
Setuper
сообщение 12.3.2009, 0:44
Сообщение #23


RusHub team lead
**************

Группа: Модераторы
Сообщений: 4 030
Регистрация: 20.6.2008
Из: г. Королёв (Моск. обл.)
Пользователь №: 46
Спасибо сказали: 1708 раз




Можно

Цитата
UDPDbg.
-------------------
Reg(sIp, nPort, bAllData) - Register to receiving data to PtokaX UDP Debug receiver, bAllData false means to receive only data from this script. Return nil when failed or true when success.
Unreg() - Remove from receiving data.
Send(sData) - Send data to udp debug. If script is registered then only to this reg, else to all. Return nil when failed or true when success.
Go to the top of the page
+Quote Post
IIPu3PAK
сообщение 12.3.2009, 3:50
Сообщение #24


Активный участник
***

Группа: Пользователи
Сообщений: 80
Регистрация: 25.2.2009
Пользователь №: 2 359
Спасибо сказали: 6 раз




Цитата
UDPDbg.
-------------------
Reg(sIp, nPort, bAllData) - Register to receiving data to PtokaX UDP Debug receiver, bAllData false means to receive only data from this script. Return nil when failed or true when success.
Unreg() - Remove from receiving data.
Send(sData) - Send data to udp debug. If script is registered then only to this reg, else to all. Return nil when failed or true when success.


непонял что с этим делать...надо какую-нибудь библиотеку подключить?

вот что птоха сказала на комманду рег
[10:50] Синтакс ...J_\PtokaX.0.3.5.2.LUA.5.1.1.RUS.by.NRJ\scripts\1.lua:6: attempt to call global 'Reg' (a nil value)

З.Ы. нашел в модуле луа-сокетс doc/udp.html Может кто переведет его на русский язык а то я ничего немогу там понять
Go to the top of the page
+Quote Post
Setuper
сообщение 12.3.2009, 11:49
Сообщение #25


RusHub team lead
**************

Группа: Модераторы
Сообщений: 4 030
Регистрация: 20.6.2008
Из: г. Королёв (Моск. обл.)
Пользователь №: 46
Спасибо сказали: 1708 раз




Код
UDPDbg.Reg(sIp, nPort, bAllData)
Go to the top of the page
+Quote Post
IIPu3PAK
сообщение 12.3.2009, 12:21
Сообщение #26


Активный участник
***

Группа: Пользователи
Сообщений: 80
Регистрация: 25.2.2009
Пользователь №: 2 359
Спасибо сказали: 6 раз




[19:20] Синтакс ...J_\PtokaX.0.3.5.2.LUA.5.1.1.RUS.by.NRJ\scripts\1.lua:6: attempt to index global 'UDPDbg' (a nil value)
what.gif

Мне надо отправить серверу " FF FF FF FF 54 53 6F 75 72 63 65 20 45 6E 67 69 6E 65 20 51 75 65 72 79 00 "
и получить ответ... может я нетак выразился?
Go to the top of the page
+Quote Post
Setuper
сообщение 12.3.2009, 12:40
Сообщение #27


RusHub team lead
**************

Группа: Модераторы
Сообщений: 4 030
Регистрация: 20.6.2008
Из: г. Королёв (Моск. обл.)
Пользователь №: 46
Спасибо сказали: 1708 раз




PtokaX.0.4.*.* нужно поставить. Эта функция работает только в новых версиях.
Go to the top of the page
+Quote Post
IIPu3PAK
сообщение 12.3.2009, 13:07
Сообщение #28


Активный участник
***

Группа: Пользователи
Сообщений: 80
Регистрация: 25.2.2009
Пользователь №: 2 359
Спасибо сказали: 6 раз




:(

З.Ы. нашел в модуле луа-сокетс doc/udp.html Может кто переведет его на русский язык а то я ничего немогу там понять
Цитата
UDP

socket.udp()

Creates and returns an unconnected UDP object. Unconnected objects support the sendto, receive, receivefrom, getsockname, setoption, settimeout, setpeername, setsockname, and close. The setpeername is used to connect the object.

In case of success, a new unconnected UDP object returned. In case of error, nil is returned, followed by an error message.

connected:close()
unconnected:close()

Closes a UDP object. The internal socket used by the object is closed and the local address to which the object was bound is made available to other applications. No further operations (except for further calls to the close method) are allowed on a closed socket.

Note: It is important to close all used sockets once they are not needed, since, in many systems, each socket uses a file descriptor, which are limited system resources. Garbage-collected objects are automatically closed before destruction, though.

connected:getpeername()

Retrieves information about the peer associated with a connected UDP object.

Returns the IP address and port number of the peer.

Note: It makes no sense to call this method on unconnected objects.

connected:getsockname()
unconnected:getsockname()

Returns the local address information associated to the object.

The method returns a string with local IP address and a number with the port. In case of error, the method returns nil.

Note: UDP sockets are not bound to any address until the setsockname or the sendto method is called for the first time (in which case it is bound to an ephemeral port and the wild-card address).

connected:receive([size])
unconnected:receive([size])

Receives a datagram from the UDP object. If the UDP object is connected, only datagrams coming from the peer are accepted. Otherwise, the returned datagram can come from any host.

The optional size parameter specifies the maximum size of the datagram to be retrieved. If there are more than size bytes available in the datagram, the excess bytes are discarded. If there are less then size bytes available in the current datagram, the available bytes are returned. If size is omitted, the maximum datagram size is used (which is currently limited by the implementation to 8192 bytes).

In case of success, the method returns the received datagram. In case of timeout, the method returns nil followed by the string 'timeout'.

unconnected:receivefrom([size])

Works exactly as the receive method, except it returns the IP address and port as extra return values (and is therefore slightly less efficient).

connected:send(datagram)

Sends a datagram to the UDP peer of a connected object.

Datagram is a string with the datagram contents. The maximum datagram size for UDP is 64K minus IP layer overhead. However datagrams larger than the link layer packet size will be fragmented, which may deteriorate performance and/or reliability.

If successful, the method returns 1. In case of error, the method returns nil followed by an error message.

Note: In UDP, the send method never blocks and the only way it can fail is if the underlying transport layer refuses to send a message to the specified address (i.e. no interface accepts the address).

unconnected:sendto(datagram, ip, port)

Sends a datagram to the specified IP address and port number.

Datagram is a string with the datagram contents. The maximum datagram size for UDP is 64K minus IP layer overhead. However datagrams larger than the link layer packet size will be fragmented, which may deteriorate performance and/or reliability. Ip is the IP address of the recipient. Host names are not allowed for performance reasons. Port is the port number at the recipient.

If successful, the method returns 1. In case of error, the method returns nil followed by an error message.

Note: In UDP, the send method never blocks and the only way it can fail is if the underlying transport layer refuses to send a message to the specified address (i.e. no interface accepts the address).

connected:setpeername('*')
unconnected:setpeername(address, port)

Changes the peer of a UDP object. This method turns an unconnected UDP object into a connected UDP object or vice versa.

For connected objects, outgoing datagrams will be sent to the specified peer, and datagrams received from other peers will be discarded by the OS. Connected UDP objects must use the send and receive methods instead of sendto and receivefrom.

Address can be an IP address or a host name. Port is the port number. If address is '*' and the object is connected, the peer association is removed and the object becomes an unconnected object again. In that case, the port argument is ignored.

In case of error the method returns nil followed by an error message. In case of success, the method returns 1.

Note: Since the address of the peer does not have to be passed to and from the OS, the use of connected UDP objects is recommended when the same peer is used for several transmissions and can result in up to 30% performance gains.

unconnected:setsockname(address, port)

Binds the UDP object to a local address.

Address can be an IP address or a host name. If address is '*' the system binds to all local interfaces using the constant INADDR_ANY. If port is 0, the system chooses an ephemeral port.

If successful, the method returns 1. In case of error, the method returns nil followed by an error message.

Note: This method can only be called before any datagram is sent through the UDP object, and only once. Otherwise, the system automatically binds the object to all local interfaces and chooses an ephemeral port as soon as the first datagram is sent. After the local address is set, either automatically by the system or explicitly by setsockname, it cannot be changed.

connected:setoption(option [, value])
unconnected:setoption(option [, value])

Sets options for the UDP object. Options are only needed by low-level or time-critical applications. You should only modify an option if you are sure you need it.

Option is a string with the option name, and value depends on the option being set:

* 'dontroute': Setting this option to true indicates that outgoing messages should bypass the standard routing facilities;
* 'broadcast': Setting this option to true requests permission to send broadcast datagrams on the socket.

The method returns 1 in case of success, or nil followed by an error message otherwise.

Note: The descriptions above come from the man pages.

connected:settimeout(value)
unconnected:settimeout(value)

Changes the timeout values for the object. By default, the receive and receivefrom operations are blocking. That is, any call to the methods will block indefinitely, until data arrives. The settimeout function defines a limit on the amount of time the functions can block. When a timeout is set and the specified amount of time has elapsed, the affected methods give up and fail with an error code.

The amount of time to wait is specified as the value parameter, in seconds. The nil timeout value allows operations to block indefinitely. Negative timeout values have the same effect.

Note: In UDP, the send and sendto methods never block (the datagram is just passed to the OS and the call returns immediately). Therefore, the settimeout method has no effect on them.

Note: The old timeout method is deprecated. The name has been changed for sake of uniformity, since all other method names already contained verbs making their imperative nature obvious.
Go to the top of the page
+Quote Post
mariner
сообщение 12.3.2009, 13:19
Сообщение #29


Местная ТехПоддержка
**********

Группа: Администраторы
Сообщений: 1 875
Регистрация: 18.7.2008
Из: Моск. Обл, г. королев, район Болшево
Пользователь №: 221
Спасибо сказали: 220 раз




Цитата
думаю 95% информации
по любой области знания
находятся в интернете
на английском языке !
Это есть фаХт !
Учите английский язык !
Повышайте свою стоимость
на современном рынке труда !
Это очень просто научится читать
технические тексты на английском языке.
Тем более у вас есть конкретная мотивация !
Скоро напишу краткий курс и
по базовому английскому.
А пока...
Используйте он-лайновый переводчик
Translate.ru
Он поможет прочитать вам тексты на
английском, немецком, французском, испанском языках - любезно и бесплатно переведя их
на корявый русский.


отличная цитата с одного сайта
Go to the top of the page
+Quote Post
IIPu3PAK
сообщение 12.3.2009, 13:24
Сообщение #30


Активный участник
***

Группа: Пользователи
Сообщений: 80
Регистрация: 25.2.2009
Пользователь №: 2 359
Спасибо сказали: 6 раз




Цитата(mariner @ 12.3.2009, 13:19) *
отличная цитата с одного сайта


техн тексты переводчики онлайновые так переводят что суть теряется уже на 2 строчке
Go to the top of the page
+Quote Post
Setuper
сообщение 12.3.2009, 13:44
Сообщение #31


RusHub team lead
**************

Группа: Модераторы
Сообщений: 4 030
Регистрация: 20.6.2008
Из: г. Королёв (Моск. обл.)
Пользователь №: 46
Спасибо сказали: 1708 раз




Так переводить же надо только отдельные слова, а потом, поняв суть о чём говориться, самому склеить из слов предложение!
Go to the top of the page
+Quote Post
Nickolya
сообщение 12.3.2009, 13:55
Сообщение #32


Главный ра******й тут...
*********

Группа: Главные администраторы
Сообщений: 1 727
Регистрация: 18.5.2008
Из: RF, 2la
Пользователь №: 1
Спасибо сказали: 776 раз




Вот набросал код, спрашивай, если что непонятно, надеюсь немного в луа мы смыслим big_smile.gif

CODE
local sDatagram = " FF FF FF FF 54 53 6F 75 72 63 65 20 45 6E 67 69 6E 65 20 51 75 65 72 79 00 " -- отсылаемые данные
local sServerIp = "127.0.0.1" -- айпи
local sServerPort = 1209 -- порт
local iTimeOut = 1/100 -- таймаут соединения на получение
local iBuferSize = nil -- размер буфера (nil - стандартный)
----------------------------------------------------------------------------

-- loads the socket module
local socket = require("socket")

local myudp = socket.udp()

myudp:settimeout(iTimeOut)
myudp:setpeername(sServerIp, sServerPort)

local _, sError = myudp:send(sDatagram, sServerIp, sServerPort)
if sError then
-- ошибка!
end

-- уже точно не помню какие функции в старом апи, так что поправьте если накосячил!
function Main()
SetTimer(1000)
StartTimer()
end

function OnStartup()
TmrMan.AddTimer(1000, "OnTimer")
end

function OnTimer()
local sData, sError = ReceiveData()
if not sError then
-- мы получили какие-то данные sData и тут уже их обрабатываем
end
end

function OnExit()
myudp:close()
end
OnError = OnExit

function ReceiveData()
local sData, sError = myudp:receive(iBuferSize)
if sError then
-- ошибка!
return nil, sError
end
return sData
end
Go to the top of the page
+Quote Post
IIPu3PAK
сообщение 12.3.2009, 14:00
Сообщение #33


Активный участник
***

Группа: Пользователи
Сообщений: 80
Регистрация: 25.2.2009
Пользователь №: 2 359
Спасибо сказали: 6 раз




я немогу перевести текст потомучто незнаю некоторые термины даже на русском ...
что за зверь "unconnected UDP object" "The setpeername is used to connect the object." и так далее

Цитата(Nickolya @ 12.3.2009, 13:55) *
Вот набросал код, спрашивай, если что непонятно, надеюсь немного в луа мы смыслим big_smile.gif


а сообщение то что я написал это в hex-коде ,это учтено в скрипте или нет?

почему то скрипт посылает мне ошибку timeout what.gif
Go to the top of the page
+Quote Post
Setuper
сообщение 12.3.2009, 14:20
Сообщение #34


RusHub team lead
**************

Группа: Модераторы
Сообщений: 4 030
Регистрация: 20.6.2008
Из: г. Королёв (Моск. обл.)
Пользователь №: 46
Спасибо сказали: 1708 раз




Цитата(IIPu3PAK @ 12.3.2009, 14:00) *
а сообщение то что я написал это в hex-коде ,это учтено в скрипте или нет?

Так это наверное должна учитывать та прога, которая находится на другой стороне (которой посылаются эти данные)
Go to the top of the page
+Quote Post
Nickolya
сообщение 12.3.2009, 14:21
Сообщение #35


Главный ра******й тут...
*********

Группа: Главные администраторы
Сообщений: 1 727
Регистрация: 18.5.2008
Из: RF, 2la
Пользователь №: 1
Спасибо сказали: 776 раз




Цитата(IIPu3PAK @ 12.3.2009, 14:00) *
а сообщение то что я написал это в hex-коде ,это учтено в скрипте или нет?

Нет, отправляется как есть эта строка, про взаимодействие программ через юдипи ничего не знаю, я попробовал ПРИМЕРНО показать тебе как пользоваться библиотекой, дальше - сам. bad_smile.gif

Таймаут - увеличь iTimeOut, это время в секундах, сделай 1 к примеру. А ошибка таймаут при получении данных будет всегда когда эти данных нет или они не пришли.
Go to the top of the page
+Quote Post
IIPu3PAK
сообщение 12.3.2009, 15:04
Сообщение #36


Активный участник
***

Группа: Пользователи
Сообщений: 80
Регистрация: 25.2.2009
Пользователь №: 2 359
Спасибо сказали: 6 раз




Цитата(Nickolya @ 12.3.2009, 14:21) *
Нет, отправляется как есть эта строка, про взаимодействие программ через юдипи ничего не знаю, я попробовал ПРИМЕРНО показать тебе как пользоваться библиотекой, дальше - сам. bad_smile.gif

Таймаут - увеличь iTimeOut, это время в секундах, сделай 1 к примеру. А ошибка таймаут при получении данных будет всегда когда эти данных нет или они не пришли.


1)ну вот как нехоро что она будет всегда.... говорила бы например что данных нет
2)а вот в пхп у меня отправляется строка вида fwrite($fp,"\xFF\xFF\xFF\xFF\x54\x53\x6F\x75\x72\x63\x65\x20\x45\x6E\x67\x69\x6E\x65\x20\x51\x75\x65\x72\x79\x00".chr(10));

а как в луа тоже самое написать? bad_smile.gif

поставил 1 ,лагает и посылает тайм аут,хотя если послать неправильный запрос сервер отвечает специальным сообщением...
Go to the top of the page
+Quote Post
Setuper
сообщение 12.3.2009, 15:14
Сообщение #37


RusHub team lead
**************

Группа: Модераторы
Сообщений: 4 030
Регистрация: 20.6.2008
Из: г. Королёв (Моск. обл.)
Пользователь №: 46
Спасибо сказали: 1708 раз




в lua языке шестнадцатеричные цифры представляются как и в с++: 0xff - означает 256
Go to the top of the page
+Quote Post
IIPu3PAK
сообщение 12.3.2009, 15:22
Сообщение #38


Активный участник
***

Группа: Пользователи
Сообщений: 80
Регистрация: 25.2.2009
Пользователь №: 2 359
Спасибо сказали: 6 раз




Цитата(Setuper @ 12.3.2009, 15:14) *
в lua языке шестнадцатеричные цифры представляются как и в с++: 0xff - означает 256

т.е. вот так local sDatagram = "0xFF0xFF0xFF0xFF0x540x530x6F0x750x720x630x650x200x450x6E0x670x690x6E0x650x200x510x750x650x720x7
90x00"
или как правильно ?
Go to the top of the page
+Quote Post
Setuper
сообщение 12.3.2009, 15:31
Сообщение #39


RusHub team lead
**************

Группа: Модераторы
Сообщений: 4 030
Регистрация: 20.6.2008
Из: г. Королёв (Моск. обл.)
Пользователь №: 46
Спасибо сказали: 1708 раз




Эта структура чисел действует только внутри языка lua.
Ответь на вопрос: в каком формате по твоему передаётся сообщение в сокет?

Если программа на другом конце соединения обрабатывает поступающие данные, то надо писать сообщение в формате, который распознает та программа.
Go to the top of the page
+Quote Post
IIPu3PAK
сообщение 12.3.2009, 15:37
Сообщение #40


Активный участник
***

Группа: Пользователи
Сообщений: 80
Регистрация: 25.2.2009
Пользователь №: 2 359
Спасибо сказали: 6 раз




Цитата(Setuper @ 12.3.2009, 15:31) *
Эта структура чисел действует только внутри языка lua.
Ответь на вопрос: в каком формате по твоему передаётся сообщение в сокет?

Если программа на другом конце соединения обрабатывает поступающие данные, то надо писать сообщение в формате, который распознает та программа.


в сокет помойму в любом случае идет хекс-код

вот прога на пхп которая получает данные с серва...может это поможет
Код
     $fp = @fsockopen("udp://".$server, $port);
     if (!$fp) return false;

     @fwrite($fp,"\xFF\xFF\xFF\xFF\x54\x53\x6F\x75\x72\x63\x65\x20\x45\x6E\x67\x69\x6E\x65\x20\x51\x75\x65\x72\x79\x00".chr(10));
     $start=time();
     socket_set_timeout($fp,1);
     $st=fread($fp,1);
     $r=socket_get_status($fp);
     $r=$r["unread_bytes"];
     if ($r == 0) { @fclose($fp); return false;}
     $st.=fread($fp,$r);

     @fclose($fp);
Go to the top of the page
+Quote Post

4 страниц V  < 1 2 3 4 >
Тема закрытаНачать новую тему
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

Collapse

> Похожие темы

  Тема Ответов Автор Просмотров Последнее сообщение
No New Posts Topic has attachmentsВывод последний N сообщений чата при входе
Verlihub
2 Vizunchik 9 630 13.9.2014, 9:53 Посл. сообщение: Ahton
No New Posts Topic has attachmentsИнфомер в чате
Помогите
1 BADam 5 403 5.6.2014, 22:20 Посл. сообщение: Артём
No New Posts Поиск по TTH и вывод на веб-сервер
1 Panasonic 7 178 1.11.2013, 17:07 Посл. сообщение: Alexey
No New Posts Скачивание файла большого объема с нескольких источников
5 nail 10 265 27.7.2012, 16:27 Посл. сообщение: nail
No new Не могу качать с пользователей с интернета
???
16 Miha 16 610 26.7.2011, 11:23 Посл. сообщение: Nickolya
No New Posts От: Сбор информации(ник, время, IP)
От темы с ID: 4850
0 demondroid 3 879 28.5.2011, 18:41 Посл. сообщение: demondroid
No New Posts Отправка информации с сайта по запросу
Отправка информации с сайта по запросу
4 sania 7 858 28.5.2011, 9:51 Посл. сообщение: sania
No New Posts Сбор информации(ник, время, IP)
Нужен скрипт сбора информации о пользователе
2 bes_dimm 6 132 25.5.2011, 20:10 Посл. сообщение: OCTAGRAM
No new Скачивание файл-листа, nmdc
Последовательность команд
16 HackFresse 25 037 3.11.2010, 12:48 Посл. сообщение: Atlant
No New Posts Есть ли такая команда чтобы немогли писать в чате без регистрации?
2 GaZz-BenziNa 8 305 30.9.2010, 22:51 Посл. сообщение: переподвыподверт
No New Posts От: Есть ли такая команда чтобы немогли писать в чате без регистрации?
От темы с ID: 3903
6 infection 8 227 27.9.2010, 6:46 Посл. сообщение: Invisible
No New Posts От: Скрипт, скрывающий ник в чате
От темы с ID: 3257
0 _Deagle_Factory_ 4 259 10.4.2010, 11:33 Посл. сообщение: _Deagle_Factory_
No new "Словарь" интернета
вот такое вот разочарование
14 Nickolya 16 166 29.3.2010, 21:03 Посл. сообщение: Saymon21
No New Posts Скрипт, скрывающий ник в чате
2 SAG 8 032 22.3.2010, 17:15 Посл. сообщение: SAG
No New Posts невыполненные команды в чате
как избежать вывода в чат невыполняемых скриптом команд
4 степашка 7 913 13.3.2010, 23:20 Посл. сообщение: степашка

 



RSS Сейчас: 2.5.2024, 20:32