Shoutbox

[Question] Winsock? - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: [Question] Winsock? (/showthread.php?tid=70451)

[Question] Winsock? by tryxter on 01-07-2007 at 09:44 PM

Hi everyone.

Great forum here! I'm starting my first plugin now. I've got some programming experience.

Already searched the forums, and found something about the winsock problem (only packed with visual studios, and can't be used due to license etc). My question is: there's anything similar to winsock that we can use?

Thanks a lot!
(sorry my english mistakes, i'm Portuguese ;))

André Ferreira


RE: [Question] Winsock? by deAd on 01-08-2007 at 12:15 AM

Depending on what you need you can use an XML HTTP request, but it's probably not suitable for what you're looking for (quite different from winsock :P).

You can also try to write a DLL/ActiveX object that allows you to do what you need.


RE: [Question] Winsock? by ShawnZ on 01-08-2007 at 12:31 AM

winsock comes with windows...


RE: [Question] Winsock? by deAd on 01-08-2007 at 12:34 AM

You can't use it in a script without having Visual Studio installed, and it violates some microsoft terms to use it :P


RE: [Question] Winsock? by ShawnZ on 01-08-2007 at 12:36 AM

quote:
Originally posted by deAd
You can't use it in a script without having Visual Studio installed, and it violates some microsoft terms to use it :P

what microsoft terms :-/
RE: [Question] Winsock? by Adeptus on 01-08-2007 at 12:47 AM

tryxter,

It might help if you explain what you want to do.  Perhaps then someone will have an idea what you can use for it. 

Winsock is an API and, as shawnz correctly points out, it's part of Windows.   Winsock is not what you need; perhaps something having to do with Winsock is, but that is unclear.


RE: RE: [Question] Winsock? by deAd on 01-08-2007 at 01:10 AM

quote:
Originally posted by ShawnZ
quote:
Originally posted by deAd
You can't use it in a script without having Visual Studio installed, and it violates some microsoft terms to use it :P

what microsoft terms :-/

http://shoutbox.menthix.net/showthread.php?tid=60242 Read that whole thread, there's stuff in there.

And it does come with windows, but I don't think a usable Active X control does...
RE: [Question] Winsock? by tryxter on 01-08-2007 at 10:03 AM

Sorry for not giving too many details.

The objective is create a listen server and a client. I'll be the server and another contact will be the client (that can be switched, of course).
Sometime ago, I've done something similar using VB and Winsock, that's why I asked for winsock...

Thanks a lot for all your answers! ;)


RE: [Question] Winsock? by Deco on 01-08-2007 at 04:43 PM

Hey Tryxter..

Here's the code for a dll I made. It looks silly because I'm sending a message to myself.. but I use it to trick another program.

code:
using System;
using System.Collections;
using System.Text;
using System.Runtime.InteropServices;
using System.Net;
using System.Net.Sockets;

namespace CS
{
    [Guid("D6F88E95-8A27-4ae6-B6DE-0542A0FC7039")]
    [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]

    public interface _Functions
    {
        [DispId(1)]
        string SendPacket(string msg, int port);
    }



    [Guid("13FE32AD-4BF8-495f-AB4D-6C61BD463EA4")]
    [ClassInterface(ClassInterfaceType.None)]
    [ProgId("MPL.Functions")]
    public class Functions : _Functions
    {
        public string SendPacket(string msg, int port)
        {
            byte[] sendBytes = Encoding.ASCII.GetBytes(msg);
            UdpClient myClient = new UdpClient();
            myClient.Send(sendBytes, sendBytes.Length, Dns.GetHostName(), port);
            return "ok";
        }
    }
}


And then this is how to use it in the script.

code:
function OnEvent_Initialize(MessengerStart)
{
var obj = new ActiveXObject("MPL.Functions");
var msg = obj.SendPacket("teste",11000);
}

Oh and the dll isn''t originally mine.. someone sent it sorry I don't rememer who :/

HAve fun!


RE: [Question] Winsock? by tryxter on 01-08-2007 at 06:51 PM

quote:
Originally posted by Deco

code:
function OnEvent_Initialize(MessengerStart)
{
var obj = new ActiveXObject("MPL.Functions");
var msg = obj.SendPacket("teste",11000);
}


I can't use it to send data to other computers, do I?
"teste" is the string sent by the function and 11000 the port that is used right?

Thanks a lot Deco. (Obrigado será o mais razoável não? :p)