Oppure

Loading
15/10/12 11:14
criscap85
Ciao da ore mi sto dannando per due cose:

1) Avere windows su questo imac invece che un computer decente e solo windows!
2) Come diavolo si fa a chiamare le funzioni esterne come InizializzaTapi??

Ecco a voi il codice!!!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net;
using System.Net.Sockets;
using JulMar.Atapi;


namespace ServerDiProva
{
    public class Program
    {                
        static void Main(string[] args)
        {
                        
            try
            {
                IPAddress ipAd = IPAddress.Parse("127.0.0.1"); //use local m/c IP address, and use the same in the client

                /* Initializes the Listener */
                TcpListener myList = new TcpListener(ipAd, 8586);

                /* Start Listeneting at the specified port */
                myList.Start();

                Console.WriteLine("Server Partito!");
                Console.WriteLine("Porta utilizzata : 8586");
                Console.WriteLine("In attesa di una connessione");

                Socket s = myList.AcceptSocket();
                Console.WriteLine("Client " + s.RemoteEndPoint.ToString() + " connesso!");

                int esci = 0;
                while (esci == 0)
                {
                    StringBuilder sb = new StringBuilder();

                    byte[] b = new byte[100];
                    int k = s.Receive(b);

                    for (int i = 0; i < k; i++)
                        sb.Append(Convert.ToChar(b[i]));//Console.Write(Convert.ToChar(b[i]));



                    if (sb.ToString() == "sto cazzo")
                    {
                        ASCIIEncoding asen = new ASCIIEncoding();
                        s.Send(asen.GetBytes("sta fica"));
                    }

                    if (sb.ToString() == "diocane")
                    {
                        ASCIIEncoding asen = new ASCIIEncoding();
                        s.Send(asen.GetBytes("vaffanculo!"));
                    }
                }
                /* clean up */
                s.Close();
                myList.Stop();

            }
            catch (Exception exc)
            {
                Console.WriteLine("Errore..... " + exc.StackTrace);
            }
        }

        private void InizializaTapi()
        {
            TapiManager _mgr = new TapiManager("");

            if (_mgr.Initialize())
            {
                foreach (TapiLine line in _mgr.Lines)
                {
                    line.Changed += this.OnLineStateChanged;
                    line.NewCall += this.OnNewCall;
                    line.Ringing += this.OnRinging;

                    line.CallInfoChanged += this.OnCallInfoChanged; // aggiunta adesso
                    line.CallStateChanged += this.OnCallStateChanged; // aggiunta adesso

                    line.Monitor();
                }
            }
        }

        private void OnCallStateChanged(object sender, CallStateEventArgs e)
        {
          
        }

        private void OnCallInfoChanged(object sender, CallInfoChangeEventArgs e)
        {
            
        }

        private void OnLineStateChanged(object sender, LineInfoChangeEventArgs e)
        {
            
        }

        private void OnNewCall(object sender, NewCallEventArgs e)
        {
            
        }

        private void OnRinging(object sender, EventArgs e)
        {
           
        }
    }
}



Grazie a chi risponderà! :D
aaa
15/10/12 12:49
Qwertj
InitializaTapi();


:om:
aaa
15/10/12 13:24
Thejuster
Postato originariamente da Qwertj:

InitializaTapi();


:om:


lol

oppure proverei a chiamarla...
Inizializatapiiiii


forse ti risponderà

eh.. eh... Ecciaff!!!
dannato raffreddore...
mire.forumfree.it/ - Mire Engine
C# UI Designer
15/10/12 17:15
Qwertj
Hey, I just write you
And this is crazy!
But here's the function,
So call it, maybe!
aaa
15/10/12 18:11
criscap85
Beh era ovvio per tutti! ma non funziona!! Oddio vs 2010 quando scrivo I non mi fa vedere che è una funzione avete presente? O devo mandarvi il progettino di prova di m.......???
aaa
15/10/12 21:20
Poggi Marco
Postato originariamente da criscap85:

Beh era ovvio per tutti! ma non funziona!! Oddio vs 2010 quando scrivo I non mi fa vedere che è una funzione avete presente? O devo mandarvi il progettino di prova di m.......???


:noway: Ma!

Manda il progetto...
aaa
16/10/12 6:50
criscap85
Questa mattina non posso. :(

Inviato da Iphone
aaa
16/10/12 9:07
La funzione, in questo caso, deve essere static

static private void InizializaTapi()