Ruby Socket to Java SocketHello !
I have some problem trying to establish dialog between a Ruby
socket(client) and a Java server socket (java.net.ServerSocket).
Everytime I try to write on the server socket I get an "Invalid stream
header" error from the server...
s = TCPSocket.open("host", 9061)
s.write("test \n");
=> Error
Can someone give a little hint on how to start inthe right way on this ?
Thx a lot !
Seurdge
--
Posted via http://www.ruby-forum.com/.
Ok, I have experiment a lot and found that :
When the Java Server use :
in = requestSocket.getInputStream();
It wo...
C socket to Ruby socketHello
What is the correct way to convert a C socket (int) to a Ruby Socket
object in a C extension? Something like
int s = socket(...);
VALUE sock = rb_some_func(s);
In my extension there's a callback function that receives a socket as an
argument, and I'd like to pass that socket as an argument to a ruby
block, so I need to convert it to a Socket object first.
Thanks in advance,
Andre
On 9/5/06, Andre Nathan <andre@digirati.com.br> wrote:
> Hello
>
> What is the correct way to convert a C socket (int) to a Ruby Socket
> object in a C extension? Something l...
socket.socket.makefileI'm writing an alternative socket module, and have come across the
code for the makefile call, which mentions the following:
(XXX refactor to share code?)
http://hg.python.org/cpython/file/27adb952813b/Lib/socket.py#l149
Has this been refactored elsewhere? Is there something I can use to
wrap the SocketIO inheriting from RawIOBase in all the variants the
io.open/socket.makefile functions return for me?
...
Help translating C# socket code equivalent Ruby socket codePossible to help in translating the following C# socket code to Ruby
socket code please. What specific socket code lines needs to do
following task.
using System.Net.Sockets;
Socket clientSock;
clientSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
receivedBytesLen = clientSock.Receive(Recievbuf, bufoffset, packetsize,
0);
int fileNameLen = BitConverter.ToChar(Recievbuf, 0);
string fileName = "image1.text";//Encoding.ASCII.GetString(Recievbuf, 4,
fileNameLen);
// MessageBox.Show("Client:{0} connected & File {1} started received."...
socket.sendall(), non-blocking sockets, and multi-threaded socket sendingMy application requires sending a large piece (~2MB) of data to
several devices on a network via TCP sockets. I have experimented with
different methods for doing this and this has raised some questions
about the implementation of Python sockets.
(both methods use blocking sockets)
Method 1: Calls socket.sendall(data) for each device in sequence, all
in a single thread.
Method 2: Each socket has its own thread that calls
socket.send(datachunk) iteratively until all data is sent.
So Method 1 sends all data to device1, then send all data to device2,
etc... until all data is sent to all devic...
socket/sendmsg seems to drop packets socket/sendmsg seems to drop packets socket/sendmsg seems to drop packets socket/sendmsg seems to drop packets socket/sendmsg seems to drop packets... how toHi,
I am using the function sendmsg to send for example 1000 packets over
a socket from one computer to another. The function call always
succeedes, i.e., -1 is never returned.
However, when using tcpdump on the sending computer, I see that only
984 out of 1000 packets are actually sent out from the computer (I see
the same 984 packets with tcpdump on the receiving computer).
How should I debug this to see where the 16 packets are dropped? It
seems as if they are dropped somewhere in the Linux kernel.
Brs,
Markus
dspfun <dspfun@hotmail.com> writes:
> I am using the function sendm...
SOCKET:SOCKET-STREAM missing?I'm using clisp on a Windows2000 machine, playing with the SOCKET features, but
I can't get anything to stream out. I get the feeling I should be doing
something with SOCKET:SOCKET-STREAM somewhere, because...
(defun x (socket:socket-server 5552))
(print "Hello" x)
....give me...
*** - PRINT: argument #<SOCKET-SERVER 0.0.0.0:5552> should be a stream
....as an error. I can connect to 5552 with telnet and then use
SOCKET:SOCKET-SERVER-CLOSE to close the connections. I just can't send data to
it.
I would use SOCKET:SOCKET-STREAM as I think I should but it gives...
socket.socket.settimeout implementationWhen using socket.socket.settimeout we normally only guard against
"socket.timeout" exception.Now the implementation of "settimeout" in
"Python-2.4.3/Modules/socketmodule.c" sets the socket fd to
nonblocking and uses "select()" to timeout
as seen below in line 1487 and 1386 :
static PyObject *
1470 sock_settimeout(PySocketSockObject *s, PyObject *arg)
1471 {
1472 double timeout;
..............................
1485
1486 s->sock_timeout = timeout;
1487 internal_setblocking(s, timeout < 0.0);
1488
1489 ...
Socket() failed for UDP socketHello,
I have recently started getting an error message, whenever i boot up my
laptop.
The error is :
" Could not start DB server: Socket() failed for UDP socket: (10106)
the requested service provider could not be loaded or initialized"
The only odd thing, i have noticed after i have started getting this
error is... I am not able to connect to my neighbor's wireless network
(says it has limited or no connectivity).
Looking forward to any help in this regard..
thanks,
KR
"Kishore_R" <kishore.racherla@gmail.com> wrote in
news:1128986695.202568.119580@g43g200...
Ruby and socket.soHi,
When I "require socket" in my application I get following error.
/usr/local/lib/ruby/1.8/x86_64-linux/socket.so: cannot open shared object
file: No such file or directory
- /usr/local/lib/ruby/1.8/x86_64-linux/socket.so
The socket.so is of course located in above directory.
Ruby test file.
require "socket"
if $0 == __FILE__
print "Hello World"
end
My ruby version is: ruby 1.8.2 (2004-12-25) [x86_64-linux]
Any help would be appriciated.
--
Peter Lerche
-------------------------------------
Linux/BSD Dedicated Server Hosting
Advanced Server Tools ...
Socket#gets and Socket#putsWe really ought to think about documenting the Socket class tree. :)
Okay, I'm learning with a little "Trial by Fire" over here. I'm
building a threaded server. I'm using Socket#gets for reading and
that's going fine. I've learned that it returns nil, when the
connection is closed. Does it throw exceptions under any conditions
and if so, which ones?
What about Socket#puts? If it's waiting to send something, what
happens if the connection is closed? Should I expect any exceptions on
this end of the equation?
Thanks.
James Edward Gray II
On ...
Socket operation on non-socketSometimes I get an error message when I try to check my mail that says
"Socket operation on non-socket." Can anyone tell me what could be
causing it?
Thanks,
Cliff Lewis
Your email server was too busy to respond within the alloted time out.
It happens sometimes when the server is too busy. If you try again it
probably works?
On Tue, 08 Mar 2005 20:27:15 -0500, Cliff Lewis <clewis@gwis.com>
wrote:
>Sometimes I get an error message when I try to check my mail that says
>"Socket operation on non-socket." Can anyone tell me what could be
>causing it?
It does usually work, although I often get another error message
saying "Error reading from network. Cause: connection aborted due to
timeout or other failure. (10053)" I get that message a lot, and I
gather that it can be caused by my antivirus program (Computer
Associates eTrust EZ Antivirus), although sometimes I still have the
problem when I disable the virus checking. I guess I am trying to
figure out if this frequent problem is caused by something on my
computer or something on the server.
On Tue, 08 Mar 2005 21:00:49 -0500, Paul Blais
<PBlais@ODStrategies.Org> wrote:
>Your email server was too busy to respond within the alloted time out.
>It happens sometimes when the server is too busy. If you try again it
>probably works?
>
>On Tue, 08 Mar 2005 20:27:15 -0500, Cliff Lewis <clewis@gwis.com>
>wrote:
>
>&...
socketHi,
Is it possible to open a TCP socket as read_only from a process, so
that I can open another socket in another process with the same ip\port
as write_only?
Thanks,
Hakim
On Thu, 16 Jun 2005 09:21:50 -0700, ddrv2002 wrote:
> Hi,
>
> Is it possible to open a TCP socket as read_only from a process, so
> that I can open another socket in another process with the same ip\port
> as write_only?
No. You'll probably want to read unix network programming btw.
M4
--
Ah, the beauty of OSS. Hundreds of volunteers worldwide volunteering
their time inventing and implementing n...
socketHi. I need to send an HTTP post specifying password and username to a
web server through a socket in order to login. I'm writing this
program in c under a linux system. How does the request has to be
formatted? I send the request using the following code:
write( socket_fd, buffer, strlen( buffer ));
where socket_fd is the socket descriptor, buffer is the string
containing the post request and strlen(buffer) its length.
thank you
Teo81 schrieb:
> Hi. I need to send an HTTP post specifying password and username to a
> web server through a socket in order to login. I'm writin...
socketSomeone knows how to send a custom object through a socket between two machines?
Thank to everyone who'll answer to me.
Linus
Linus wrote:
>
> Someone knows how to send a custom object through a socket between two machines?
Serialization.
--
Lee Fesperman, FFE Software, Inc. (http://www.firstsql.com)
==============================================================
* The Ultimate DBMS is here!
* FirstSQL/J Object/Relational DBMS (http://www.firstsql.com)
On 9 Mar 2005 01:29:22 -0800, Linus wrote:
> Someone knows how to send a custom object through a socket between
> two m...
SocketWe are using VA Smalltalk 8.5 and TobSockets in the normal client/server sense.
However, I need to communicate with a vendor software using the same port for client and server TCP packets. Don't ask me to change the design it is not my decision.
Can you Smalltalkers provide some advice if there is a good way to do this in TobSockets? I don't really want to play around in SciScoket. Thanks!
Bernard
Hi Bernard,
I use Totally Objects SocketSet a lot, so maybe I can help. Can you tell
more about what you are trying to do. Is your code connecting to the
vendor software or i...
socket.unbind or socket.unlisten? I have a program that uses socket.bind() and socket.listen() frequently.
After that program stops, it is not able to bind() again for a while:
File "/home/gandalf/Python/Lib/orb/accesspoints/srvtcp.py", line 27, in
__init__
self.serversocket.bind((self.listen_address,self.port))
File "<string>", line 1, in bind
socket.error: (48, 'Address already in use')
The problem with this, is that this server program SOMETIMES need to be
restarted very quickly. I tried to find the solution in the socket
module. But there is no "socket.unbind" or &q...
Uncatchable socket.error in socket.py (?)Hi,
I've written a very simple 'kill-server' to help me shut down
processes through Telnet or HTTP. The kill-server is a function and is
launched as a thread. I use the module socket.py on Python v2.3
(Windows)
I can use telnet host:port and enter the secret killword or
use a broser with http://host:port/secret_killword
The 'kill-server' validates the secret_killword and writes a file
to /tmp. The main process regularly checks for the existence of that
file, and ends the loop if it does exist.
It works well.
But most for the fun (because this will probably never be
ex...
Reconnect socket without close/socket?I am writing a program that needs to read some data from a server via a
TCP socket every few seconds. (The server is the hddtemp program,
running in daemon mode.)
Documentation is somewhat sparse, but AFAICT the server simply accepts
connections, writes its output to the socket, and immediately closes it.
So every time I want to poll the server, I need to reconnect.
Is there any way to accomplish this without doing a close()/socket()
cycle every time? I've tried using shutdown(fd, SHUT_RDWR), but I get a
"Transport endpoint is already connected" error.
Thanks!
...
problems with sockets while implemting posix socketsIn the function msg_receive, fd is a socket connected to a remote
Internet client. What is wrong with msg_receive? Suggest a fix.
#define MAXVALS 65536
typedef struct _msg_t {
unsigned int num;
unsigned int values[MAXVALS];
} msg_t;
int msg_receive (int fd, msg_t *m)
{
size_t sz = sizeof (unsigned int);
assert (m);
if (read (fd, (void *)&m->num, sz) < sz)
return -1;
return read (fd, (void *)&m->values, sz * m->num);
}
On 21 Feb 2005 12:50:09 -0800, puzzlecracker <ironsel2000@gmail.com> wrote...
Socket Error 10038 on Multicast SocketHi,
I get WSAENOTSOCK (10038) error on a Multicast socket when a packet is
multicast to a multicast address that the socket has joined.
The strange thing is, I get the error only on one particular system,
installed with Windows XP Pro (SP2). I have other XP Pro (SP2) systems,
but they dont give this error. Anyone else with the same problem?
I tried changing the network card to use a PCI card that I know works
fine in other systems, but still the same problem. Oh the said system
has Microsoft Virtual PC installed as well. Could be causing the problem?
TIA
Hari
*** Posted via a free Usenet account from http://www.teranews.com ***
...
Socket 478 to Socket 775 adapter?Hi all,
The P4 on my desktop is a Skt.478. With Intel now not producing the 478
anymore, if I wanted to upgrade the chip to a higher speed such that there
was not any 478's produced at that speed, I am looking at buying a new MoBo
which is a definate no at the moment with my system just having a new board
in it (ASUS P4S800). Does anyone know if there is a Socket 478 to Socket
775 adapter available? I have checked powerleap.com, and they only have a
Socket 423 to Socket 478 and no higher.
Thanks,
Neil
--
Desktop = P4 Northwood @ 2.6GHz, 512MB PC2100, 120GB HD, 256MB XFX
GeFo...
[socket] test if socket descriptor is validHi
Is it possible to check that a socket descriptor is valid before
receiveing data ( recv) ?
maybe fstat ?
"mbm" <mbmessaoud@yahoo.com> wrote in message
news:1190890077.826077.15620@57g2000hsv.googlegroups.com...
> Hi
>
> Is it possible to check that a socket descriptor is valid before
> receiveing data ( recv) ?
>
> maybe fstat ?
Why bother? recv will return EBADF if the descriptor is invalid
anyway. However you are correct - using fstat you can check the
st_mode field for the file type. Note this is only valid if fstat
returns correctly... you may ...
Socket programming: Command and Data socketHi all,
I am learning about socket programming from the books from Richard
Stevens. I just started, but browsing thru the books I didn't find an
example of how one could implement a program that uses two sockets for
communication (like for example the FTP command, which uses a data and
a command socket).
I am trying to write such a program myself, but I can't really get
around the design of the program. My questions is relatively simple (I
think). How would I go about setting up communication with two
sockets? I just need ideas on how to do this. I've been trying to get
this work...