Questions tagged [io-socket]

IO::Socket - Object interface to socket communications

IO::Socket provides an object interface to creating and using sockets. It is built upon the IO::Handle interface and inherits all the methods defined by IO::Handle.

25 questions
12
votes
1 answer

Perl6 IO::Socket::Async truncates data

I'm rewriting my P5 socket server in P6 using IO::Socket::Async, but the data received got truncated 1 character at the end and that 1 character is received on the next connection. Someone from Perl6 Facebook group (Jonathan Worthington) pointed…
Zarul Zakuan
  • 510
  • 3
  • 13
9
votes
1 answer

Check if socket is connected before sending data

I'm programming a simple code using socket connection in perl: $sock = new IO::Socket::INET( PeerAddr => '192.168.10.7', PeerPort => 8000, Proto => 'tcp'); $sock or die "no socket :$!"; Then…
Lucas Rey
  • 449
  • 6
  • 13
5
votes
1 answer

MOAR process ballooning while running Perl6 socket server

I have a socket server using IO::Socket::Async and Redis::Async for message publishing. Whenever there is a message received by the server, the script would translate the message and generate acknowledge message to be sent back to the sender so that…
Zarul Zakuan
  • 510
  • 3
  • 13
4
votes
0 answers

Perl Net::WebSocket::Server

I am using the Perl Module Net::WebSocket::Server to build a message deliver system for users that are visiting a domain. I amd using the example scripts from the CPAN module page, and this is the code I have running: #!/usr/bin/perl use strict; use…
BryanD
  • 41
  • 3
3
votes
2 answers

Persistent connection with simple TCP server

Using this simple TCP server/client example in perl, how can I keep sending and receiving without having to reopen the connection (continuously receive data, and process it as it arrives)? Server: use IO::Socket::INET; # auto-flush on socket $| =…
DexterGold
  • 31
  • 2
2
votes
2 answers

How do I set `SO_RCVTIMEO` on a socket in Perl?

If I try like this: my $sock = IO::Socket::INET->new( … ) or die "no socket for you"; defined $sock->setsockopt(SOL_SOCKET, SO_RCVTIMEO, 30) or die "setsockopt: $!"; then my script suffers death from "setsockopt: Invalid…
derobert
  • 49,731
  • 15
  • 94
  • 124
2
votes
0 answers

Creating a UDP server using IO::Socket::INET without specifying a port

I am trying to create a UDP server using perl IO::Socket::INET. I am facing difficulty with using the following parameters: LocalHost => "0.0.0.0" LocalPort => 0 What I am trying to achieve is to: Listen on all NICs, hence the use of 0.0.0.0 Have…
Ayman Salah
  • 1,039
  • 14
  • 35
2
votes
1 answer

Expo React Native application inside of iOS Simulator keeps reconnecting using socket.io

The stack is atm VueJS, React Native using Expo, and NestJS for the backend. For convenience, this repo contains a working example of VueJS and NestJS parts. The connection from the React Native side (simplified version) is implemented like…
Vladyslav Zavalykhatko
  • 15,202
  • 8
  • 65
  • 100
2
votes
1 answer

Sending file over UDP in Perl

Afternoon, I am writing a small UDP Client/Server in Perl and am having some issues sending files. I understand I need to break the file into chunks (datagrams) and send them to the server. I am stuck figuring out how to break the file up into…
rusty
  • 307
  • 1
  • 4
  • 16
2
votes
1 answer

how to remove a IO::Async::Listener (or its notifier) object from a IO::Async::Loop event in perl

I have a piece of code that creates a UNIX domain socket using IO::Socket::UNIX and gives it to an instance of IO::Async::Listener to handle listening on the socket and notifying on receiving data. The IO::Async::Listener, then, is added to a…
ashraf
  • 537
  • 7
  • 16
1
vote
2 answers

I get socket exception (connection reset ) on client side whenever I try to read data form the server

when I run the code for the code below for the firs time it runs just fine then I try to add more code (like creating buffered input stream in server side and try to read back from the client ) and run it again it gives me this exception in client…
Ahmed Mohamed
  • 11
  • 1
  • 3
1
vote
2 answers

Does IO::Socket::INET->new return undefined on error?

I have the following code (part of a larger script) my $lsn = IO::Socket::INET->new(Listen => 1, LocalPort => 0); # just use any available port. $port = $lsn->sockport(); I'm getting the error Can't call method "sockport" on an undefined value. The…
Bwmat
  • 4,314
  • 3
  • 27
  • 42
1
vote
2 answers

how to add authorization header to IO.socket call in android

JSONObject getobj = new JSONObject(); postobj.put("url", String.format("/user")); Log.d("Get MEthod", getobj.toString() + ">>>>>>>>>>>>>>>>>>>>Get Message " + socket.connected()); Log.d(TAG, " the meessage url " +…
user3334050
  • 21
  • 1
  • 2
1
vote
2 answers

Handling cookies in an HTTP server

This is my first time posting to this site, but I come to it often. I am stuck on a project I am coding for fun. I am total newbie to Perl so go easy on me. I've successfully written a web server in Perl, it parses PHP and handles multiple…
1
vote
1 answer

Small issue with IO::Socket server and POST data

For some reasons I can only use IO::Socket to build my small http server (not the other modules dedicated to that). EDIT1: I edited my question, I want to know what I can put instead of the commented line "#last ..." Here is my script: use…
ubugnu
  • 1,004
  • 2
  • 15
  • 30
1
2