Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
C# / VB.NET - [C#] Urgente aiuto! Chiamare una funzione!
Forum - C# / VB.NET - [C#] Urgente aiuto! Chiamare una funzione!

Pagine: [ 1 2 ] Precedente | Prossimo
Avatar
criscap85 (Normal User)
Pro


Messaggi: 99
Iscritto: 29/01/2012

Segnala al moderatore
Postato alle 13:14
Lunedì, 15/10/2012
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!!!

Codice sorgente - presumibilmente C++

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.IO;
  6. using System.Net;
  7. using System.Net.Sockets;
  8. using JulMar.Atapi;
  9.  
  10.  
  11. namespace ServerDiProva
  12. {
  13.     public class Program
  14.     {                
  15.         static void Main(string[] args)
  16.         {
  17.                        
  18.             try
  19.             {
  20.                 IPAddress ipAd = IPAddress.Parse("127.0.0.1"); //use local m/c IP address, and use the same in the client
  21.  
  22.                 /* Initializes the Listener */
  23.                 TcpListener myList = new TcpListener(ipAd, 8586);
  24.  
  25.                 /* Start Listeneting at the specified port */
  26.                 myList.Start();
  27.  
  28.                 Console.WriteLine("Server Partito!");
  29.                 Console.WriteLine("Porta utilizzata : 8586");
  30.                 Console.WriteLine("In attesa di una connessione");
  31.  
  32.                 Socket s = myList.AcceptSocket();
  33.                 Console.WriteLine("Client " + s.RemoteEndPoint.ToString() + " connesso!");
  34.  
  35.                 int esci = 0;
  36.                 while (esci == 0)
  37.                 {
  38.                     StringBuilder sb = new StringBuilder();
  39.  
  40.                     byte[] b = new byte[100];
  41.                     int k = s.Receive(b);
  42.  
  43.                     for (int i = 0; i < k; i++)
  44.                         sb.Append(Convert.ToChar(b[i]));//Console.Write(Convert.ToChar(b[i]));
  45.  
  46.  
  47.  
  48.                     if (sb.ToString() == "sto cazzo")
  49.                     {
  50.                         ASCIIEncoding asen = new ASCIIEncoding();
  51.                         s.Send(asen.GetBytes("sta fica"));
  52.                     }
  53.  
  54.                     if (sb.ToString() == "diocane")
  55.                     {
  56.                         ASCIIEncoding asen = new ASCIIEncoding();
  57.                         s.Send(asen.GetBytes("vaffanculo!"));
  58.                     }
  59.                 }
  60.                 /* clean up */
  61.                 s.Close();
  62.                 myList.Stop();
  63.  
  64.             }
  65.             catch (Exception exc)
  66.             {
  67.                 Console.WriteLine("Errore..... " + exc.StackTrace);
  68.             }
  69.         }
  70.  
  71.         private void InizializaTapi()
  72.         {
  73.             TapiManager _mgr = new TapiManager("");
  74.  
  75.             if (_mgr.Initialize())
  76.             {
  77.                 foreach (TapiLine line in _mgr.Lines)
  78.                 {
  79.                     line.Changed += this.OnLineStateChanged;
  80.                     line.NewCall += this.OnNewCall;
  81.                     line.Ringing += this.OnRinging;
  82.  
  83.                     line.CallInfoChanged += this.OnCallInfoChanged; // aggiunta adesso
  84.                     line.CallStateChanged += this.OnCallStateChanged; // aggiunta adesso
  85.  
  86.                     line.Monitor();
  87.                 }
  88.             }
  89.         }
  90.  
  91.         private void OnCallStateChanged(object sender, CallStateEventArgs e)
  92.         {
  93.          
  94.         }
  95.  
  96.         private void OnCallInfoChanged(object sender, CallInfoChangeEventArgs e)
  97.         {
  98.            
  99.         }
  100.  
  101.         private void OnLineStateChanged(object sender, LineInfoChangeEventArgs e)
  102.         {
  103.            
  104.         }
  105.  
  106.         private void OnNewCall(object sender, NewCallEventArgs e)
  107.         {
  108.            
  109.         }
  110.  
  111.         private void OnRinging(object sender, EventArgs e)
  112.         {
  113.            
  114.         }
  115.     }
  116. }



Grazie a chi risponderà! :D

PM Quote
Avatar
Qwertj (Dev Team)
Guru


Messaggi: 678
Iscritto: 30/05/2011

Segnala al moderatore
Postato alle 14:49
Lunedì, 15/10/2012
Codice sorgente - presumibilmente Plain Text

  1. InitializaTapi();



:om:

PM Quote
Avatar
Thejuster (Admin)
Guru^2


Messaggi: 2306
Iscritto: 04/05/2008

Segnala al moderatore
Postato alle 15:24
Lunedì, 15/10/2012
Testo quotato

Postato originariamente da Qwertj:

Codice sorgente - presumibilmente Plain Text

  1. InitializaTapi();



:om:



lol

oppure proverei a chiamarla...
Inizializatapiiiii


forse ti risponderà

eh.. eh... Ecciaff!!!
dannato raffreddore...


https://mire.forumfree.it/ - Mire Engine
C# UI Designer
PM Quote
Avatar
Qwertj (Dev Team)
Guru


Messaggi: 678
Iscritto: 30/05/2011

Segnala al moderatore
Postato alle 19:15
Lunedì, 15/10/2012
Hey, I just write you
And this is crazy!
But here's the function,
So call it, maybe!

PM Quote
Avatar
criscap85 (Normal User)
Pro


Messaggi: 99
Iscritto: 29/01/2012

Segnala al moderatore
Postato alle 20:11
Lunedì, 15/10/2012
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.......???

PM Quote
Avatar
Poggi Marco (Member)
Guru


Messaggi: 969
Iscritto: 05/01/2010

Segnala al moderatore
Postato alle 23:20
Lunedì, 15/10/2012
Testo quotato

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...

PM Quote
Avatar
criscap85 (Normal User)
Pro


Messaggi: 99
Iscritto: 29/01/2012

Segnala al moderatore
Postato alle 8:50
Martedì, 16/10/2012
Questa mattina non posso. :(

Inviato da Iphone

PM Quote
Avatar
nessuno (Normal User)
Guru^2


Messaggi: 6404
Iscritto: 03/01/2010

Segnala al moderatore
Postato alle 11:07
Martedì, 16/10/2012
La funzione, in questo caso, deve essere static

static private void InizializaTapi()


Ricorda che nessuno è obbligato a risponderti e che nessuno è perfetto ...
---
Il grande studioso italiano Bruno de Finetti ( uno dei padri fondatori del moderno Calcolo delle probabilità ) chiamava il gioco del Lotto Tassa sulla stupidità.
PM Quote
Avatar
criscap85 (Normal User)
Pro


Messaggi: 99
Iscritto: 29/01/2012

Segnala al moderatore
Postato alle 15:00
Martedì, 16/10/2012
Ok. Ma perchè mai questa staticità che io l'ho usata raramente? A che serve? Io non ne ho mai avuto bisogno ho usato public e private. Basta.
Grazie
Potete chiudere topic.

PM Quote
Pagine: [ 1 2 ] Precedente | Prossimo