- bits & pieces about software development HostingAbc Logo
Show all posts.
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
namespace ConsoleApplication1
{
    using System;
    using System.Text;
    using System.Net;
    using System.Net.Sockets;

    public class ConsoleApplication1
    {
        protected const int PJL_PORT = 9100;
        protected static string message = "Ready";

        public static int Main(string{} args)
        {
            if (!ParseArgs(args))
            {
                return -1;
            }

            IPEndPoint ipEndPoint;
            ipEndPoint = new IPEndPoint(Dns.Resolve(args{0}).AddressList{0}, PJL_PORT);

            Socket socket;
            socket = new Socket(
                              AddressFamily.InterNetwork,
                              SocketType.Stream,
                              ProtocolType.Tcp
                           );

            socket.Connect(ipEndPoint);

            byte{} sendData;
            string sendString;

            sendString = String.Format(
                      "\x1B%-12345X@PJL RDYMSG DISPLAY = \"{0}\"\r\n\x1B%-12345X\r\n",
                      message
                 );

            sendData = Encoding.ASCII.GetBytes(sendString);

            socket.Send(sendData, sendData.Length, 0);

            socket.Close();

            return 0;
        }

        protected static bool ParseArgs(string{} args)
        {
            if (args.Length != 2)
            {
                Console.WriteLine("set printername and message");
                return false;
            }

            if (args{1}.Length > 16)
            {
                Console.WriteLine("Message must be <= 16 characters");
                return false;
            }

            message = args{1};

            return true;
        }
    }
}

Forrás: http://vortexhunter.blogspot.com/2008/06/c-hp-laserjet-fun-fun-fun.html
add linkThe last comments:moszidev says:Venemo: it is at System.Web.Configuration.HttpConfigurationSystem.UseHttpConfigurationSystem moszidev says:dumb, ... no wonder your name is dumb :) ... i more or less expected these type of answers :) - trust me, i know the double locking design pattern :) ... but it seems that you don't really know for what the locking is needed ;) ...dumb says:this is called double locking: http://en.wikipedia.org/wiki/Double_checked_locking_patternVenemo says:Where did you find this in the framework?moszidev says:just found out that the maximum transfer rate on USB or UTP for this router is 3.5MBytes/sec. (that is 28MBit / sec)[br] So if you have a connection speed higher than this, it will not be fully used for sure.moszidev says:yepp, i know dd-wrt as well ;) - actually what i liked in oleg's firmware is that he didn't change the web ui ( which actualy i turned it off completely now ... ) - he just added new functionality to it.Kornel Javor says:If you're interested in custom firmwares, you should try dd-wrt too. As far as I know, your gadget is supported. Take a look at http://dd-wrt.com Dozens of new features were revealed after it was deployed to my Linksys and turned to a thousand do
Copyright (C) 2007, Molnar Szilveszter m@il me